Hi,

I have been able to make lots of e-mails in CRM 1.2.

For the life of me, I cannot seem to figure out how to get them to work in
3.0. Here is my code:

activityparty[] activitypartyFrom;
activitypartyFrom[0].addressused = HDEmailAddress;
activitypartyFrom[0].partyid.name = HDGuid;
activitypartyFrom[0].participationtypemask.Value = 1;


activityparty[] activitypartyTo;
activitypartyTo[0].addressused = HDEmailAddress;
activitypartyTo[0].partyid.name = HDGuid;
activitypartyTo[0].participationtypemask.Value = 2;


email.to = activitypartyTo;
email.from = activitypartyFrom;
email.subject = "This is a test";

This code will not even compile properly.

I have also tried this:

activityparty activitypartyFrom;
activitypartyFrom.addressused = HDEmailAddress;
activitypartyFrom.partyid.name = HDGuid;
activitypartyFrom.participationtypemask.Value = 1;


activityparty activitypartyTo;
activitypartyTo.addressused = HDEmailAddress;
activitypartyTo.partyid.name = HDGuid;
activitypartyTo.participationtypemask.Value = 2;


email.to = activitypartyTo;
email.from = activitypartyFrom;
email.subject = "This is a test";


AND I have tried this:


activityparty activitypartyFrom = new activityparty();
activitypartyFrom.addressused = HDEmailAddress;
activitypartyFrom.partyid.name = HDGuid;
activitypartyFrom.participationtypemask.Value = 1;


activityparty activitypartyTo = new activityparty();
activitypartyTo.addressused = HDEmailAddress;
activitypartyTo.partyid.name = HDGuid;
activitypartyTo.participationtypemask.Value = 2;


email.to = activitypartyTo;
email.from = activitypartyFrom;
email.subject = "This is a test";

I am getting conversion issues of arraylists and activityparty types. I
understand this error, but cannot seem to figure out how to resolve it. Can
someone post me an example code of how to create and send an e-mail
programmatically in CRM v3.0.

Regards,
Keener

Re: Create an e-mail in CRM 3.0 by Jeffry

Jeffry
Wed Feb 22 14:04:48 CST 2006

This works for me:

// Create the email
email myEmail = new email();

// Set Email's Properties
myEmail.subject = "some subject;
myEmail.description = "some description";

// From/To
activityparty party = new activityparty();
party.partyid = new Lookup();
party.partyid.type = EntityName.systemuser.ToString();
party.partyid.Value = someGuid;

myEmail.from = new activityparty[] {party};
myEmail.to = new activityparty[] {party};

Guid emailId = _service.Create(myEmail);

// Get a TrackingToken
GetTrackingTokenEmailRequest getTrackingToken = new
GetTrackingTokenEmailRequest();
getTrackingToken.Subject = myEmail.subject;
GetTrackingTokenEmailResponse getTrackingTokenResponse =
(GetTrackingTokenEmailResponse)_service.Execute(getTrackingToken);

// Send the email
SendEmailRequest request = new SendEmailRequest();
request.EmailId = emailId;
request.IssueSend = true;
request.TrackingToken = getTrackingTokenResponse.TrackingToken;

HTH,

--
Jeffry van de Vuurst
CWR Mobility
www.cwrmobility.com
--
"Keener" <Keener@discussions.microsoft.com> wrote in message
news:09005AAF-209C-4E73-BF9A-F6699408449D@microsoft.com...
> Hi,
>
> I have been able to make lots of e-mails in CRM 1.2.
>
> For the life of me, I cannot seem to figure out how to get them to work in
> 3.0. Here is my code:
>
> activityparty[] activitypartyFrom;
> activitypartyFrom[0].addressused = HDEmailAddress;
> activitypartyFrom[0].partyid.name = HDGuid;
> activitypartyFrom[0].participationtypemask.Value = 1;
>
>
> activityparty[] activitypartyTo;
> activitypartyTo[0].addressused = HDEmailAddress;
> activitypartyTo[0].partyid.name = HDGuid;
> activitypartyTo[0].participationtypemask.Value = 2;
>
>
> email.to = activitypartyTo;
> email.from = activitypartyFrom;
> email.subject = "This is a test";
>
> This code will not even compile properly.
>
> I have also tried this:
>
> activityparty activitypartyFrom;
> activitypartyFrom.addressused = HDEmailAddress;
> activitypartyFrom.partyid.name = HDGuid;
> activitypartyFrom.participationtypemask.Value = 1;
>
>
> activityparty activitypartyTo;
> activitypartyTo.addressused = HDEmailAddress;
> activitypartyTo.partyid.name = HDGuid;
> activitypartyTo.participationtypemask.Value = 2;
>
>
> email.to = activitypartyTo;
> email.from = activitypartyFrom;
> email.subject = "This is a test";
>
>
> AND I have tried this:
>
>
> activityparty activitypartyFrom = new activityparty();
> activitypartyFrom.addressused = HDEmailAddress;
> activitypartyFrom.partyid.name = HDGuid;
> activitypartyFrom.participationtypemask.Value = 1;
>
>
> activityparty activitypartyTo = new activityparty();
> activitypartyTo.addressused = HDEmailAddress;
> activitypartyTo.partyid.name = HDGuid;
> activitypartyTo.participationtypemask.Value = 2;
>
>
> email.to = activitypartyTo;
> email.from = activitypartyFrom;
> email.subject = "This is a test";
>
> I am getting conversion issues of arraylists and activityparty types. I
> understand this error, but cannot seem to figure out how to resolve it.
> Can
> someone post me an example code of how to create and send an e-mail
> programmatically in CRM v3.0.
>
> Regards,
> Keener
>
>



Re: Create an e-mail in CRM 3.0 by Keener

Keener
Wed Feb 22 14:56:30 CST 2006

Thank you very much Jeffry. I have a question for you. WHERE DID YOU FIND
OUT HOW TO DO THIS? I looked in the SDK documentation and nuthin!!! Did I
miss this or does Microsoft expect people to use copious amounts of time
"stumbling" through stuff like this. Where Microsoft is the documentation
for this, so I don't have to waste an entire morning struggling how to find
out how this documentation works?

Thanks again Jeffry.

Regards,
Keener

"Jeffry van de Vuurst" wrote:

> This works for me:
>
> // Create the email
> email myEmail = new email();
>
> // Set Email's Properties
> myEmail.subject = "some subject;
> myEmail.description = "some description";
>
> // From/To
> activityparty party = new activityparty();
> party.partyid = new Lookup();
> party.partyid.type = EntityName.systemuser.ToString();
> party.partyid.Value = someGuid;
>
> myEmail.from = new activityparty[] {party};
> myEmail.to = new activityparty[] {party};
>
> Guid emailId = _service.Create(myEmail);
>
> // Get a TrackingToken
> GetTrackingTokenEmailRequest getTrackingToken = new
> GetTrackingTokenEmailRequest();
> getTrackingToken.Subject = myEmail.subject;
> GetTrackingTokenEmailResponse getTrackingTokenResponse =
> (GetTrackingTokenEmailResponse)_service.Execute(getTrackingToken);
>
> // Send the email
> SendEmailRequest request = new SendEmailRequest();
> request.EmailId = emailId;
> request.IssueSend = true;
> request.TrackingToken = getTrackingTokenResponse.TrackingToken;
>
> HTH,
>
> --
> Jeffry van de Vuurst
> CWR Mobility
> www.cwrmobility.com
> --
> "Keener" <Keener@discussions.microsoft.com> wrote in message
> news:09005AAF-209C-4E73-BF9A-F6699408449D@microsoft.com...
> > Hi,
> >
> > I have been able to make lots of e-mails in CRM 1.2.
> >
> > For the life of me, I cannot seem to figure out how to get them to work in
> > 3.0. Here is my code:
> >
> > activityparty[] activitypartyFrom;
> > activitypartyFrom[0].addressused = HDEmailAddress;
> > activitypartyFrom[0].partyid.name = HDGuid;
> > activitypartyFrom[0].participationtypemask.Value = 1;
> >
> >
> > activityparty[] activitypartyTo;
> > activitypartyTo[0].addressused = HDEmailAddress;
> > activitypartyTo[0].partyid.name = HDGuid;
> > activitypartyTo[0].participationtypemask.Value = 2;
> >
> >
> > email.to = activitypartyTo;
> > email.from = activitypartyFrom;
> > email.subject = "This is a test";
> >
> > This code will not even compile properly.
> >
> > I have also tried this:
> >
> > activityparty activitypartyFrom;
> > activitypartyFrom.addressused = HDEmailAddress;
> > activitypartyFrom.partyid.name = HDGuid;
> > activitypartyFrom.participationtypemask.Value = 1;
> >
> >
> > activityparty activitypartyTo;
> > activitypartyTo.addressused = HDEmailAddress;
> > activitypartyTo.partyid.name = HDGuid;
> > activitypartyTo.participationtypemask.Value = 2;
> >
> >
> > email.to = activitypartyTo;
> > email.from = activitypartyFrom;
> > email.subject = "This is a test";
> >
> >
> > AND I have tried this:
> >
> >
> > activityparty activitypartyFrom = new activityparty();
> > activitypartyFrom.addressused = HDEmailAddress;
> > activitypartyFrom.partyid.name = HDGuid;
> > activitypartyFrom.participationtypemask.Value = 1;
> >
> >
> > activityparty activitypartyTo = new activityparty();
> > activitypartyTo.addressused = HDEmailAddress;
> > activitypartyTo.partyid.name = HDGuid;
> > activitypartyTo.participationtypemask.Value = 2;
> >
> >
> > email.to = activitypartyTo;
> > email.from = activitypartyFrom;
> > email.subject = "This is a test";
> >
> > I am getting conversion issues of arraylists and activityparty types. I
> > understand this error, but cannot seem to figure out how to resolve it.
> > Can
> > someone post me an example code of how to create and send an e-mail
> > programmatically in CRM v3.0.
> >
> > Regards,
> > Keener
> >
> >
>
>
>

Re: Create an e-mail in CRM 3.0 by Jeffry

Jeffry
Wed Feb 22 15:19:38 CST 2006

No, you didnt' miss it. I did spent some time figuring this out. Creating
the email actually was the easy part. Sending it took the most time to
figure out.

--
Jeffry van de Vuurst
CWR Mobility
www.cwrmobility.com
--
"Keener" <Keener@discussions.microsoft.com> wrote in message
news:E9D09DF7-17B9-403A-9087-91B7B5C8ED97@microsoft.com...
> Thank you very much Jeffry. I have a question for you. WHERE DID YOU
> FIND
> OUT HOW TO DO THIS? I looked in the SDK documentation and nuthin!!! Did
> I
> miss this or does Microsoft expect people to use copious amounts of time
> "stumbling" through stuff like this. Where Microsoft is the documentation
> for this, so I don't have to waste an entire morning struggling how to
> find
> out how this documentation works?
>
> Thanks again Jeffry.
>
> Regards,
> Keener
>
> "Jeffry van de Vuurst" wrote:
>
>> This works for me:
>>
>> // Create the email
>> email myEmail = new email();
>>
>> // Set Email's Properties
>> myEmail.subject = "some subject;
>> myEmail.description = "some description";
>>
>> // From/To
>> activityparty party = new activityparty();
>> party.partyid = new Lookup();
>> party.partyid.type = EntityName.systemuser.ToString();
>> party.partyid.Value = someGuid;
>>
>> myEmail.from = new activityparty[] {party};
>> myEmail.to = new activityparty[] {party};
>>
>> Guid emailId = _service.Create(myEmail);
>>
>> // Get a TrackingToken
>> GetTrackingTokenEmailRequest getTrackingToken = new
>> GetTrackingTokenEmailRequest();
>> getTrackingToken.Subject = myEmail.subject;
>> GetTrackingTokenEmailResponse getTrackingTokenResponse =
>> (GetTrackingTokenEmailResponse)_service.Execute(getTrackingToken);
>>
>> // Send the email
>> SendEmailRequest request = new SendEmailRequest();
>> request.EmailId = emailId;
>> request.IssueSend = true;
>> request.TrackingToken = getTrackingTokenResponse.TrackingToken;
>>
>> HTH,
>>
>> --
>> Jeffry van de Vuurst
>> CWR Mobility
>> www.cwrmobility.com
>> --
>> "Keener" <Keener@discussions.microsoft.com> wrote in message
>> news:09005AAF-209C-4E73-BF9A-F6699408449D@microsoft.com...
>> > Hi,
>> >
>> > I have been able to make lots of e-mails in CRM 1.2.
>> >
>> > For the life of me, I cannot seem to figure out how to get them to work
>> > in
>> > 3.0. Here is my code:
>> >
>> > activityparty[] activitypartyFrom;
>> > activitypartyFrom[0].addressused = HDEmailAddress;
>> > activitypartyFrom[0].partyid.name = HDGuid;
>> > activitypartyFrom[0].participationtypemask.Value = 1;
>> >
>> >
>> > activityparty[] activitypartyTo;
>> > activitypartyTo[0].addressused = HDEmailAddress;
>> > activitypartyTo[0].partyid.name = HDGuid;
>> > activitypartyTo[0].participationtypemask.Value = 2;
>> >
>> >
>> > email.to = activitypartyTo;
>> > email.from = activitypartyFrom;
>> > email.subject = "This is a test";
>> >
>> > This code will not even compile properly.
>> >
>> > I have also tried this:
>> >
>> > activityparty activitypartyFrom;
>> > activitypartyFrom.addressused = HDEmailAddress;
>> > activitypartyFrom.partyid.name = HDGuid;
>> > activitypartyFrom.participationtypemask.Value = 1;
>> >
>> >
>> > activityparty activitypartyTo;
>> > activitypartyTo.addressused = HDEmailAddress;
>> > activitypartyTo.partyid.name = HDGuid;
>> > activitypartyTo.participationtypemask.Value = 2;
>> >
>> >
>> > email.to = activitypartyTo;
>> > email.from = activitypartyFrom;
>> > email.subject = "This is a test";
>> >
>> >
>> > AND I have tried this:
>> >
>> >
>> > activityparty activitypartyFrom = new activityparty();
>> > activitypartyFrom.addressused = HDEmailAddress;
>> > activitypartyFrom.partyid.name = HDGuid;
>> > activitypartyFrom.participationtypemask.Value = 1;
>> >
>> >
>> > activityparty activitypartyTo = new activityparty();
>> > activitypartyTo.addressused = HDEmailAddress;
>> > activitypartyTo.partyid.name = HDGuid;
>> > activitypartyTo.participationtypemask.Value = 2;
>> >
>> >
>> > email.to = activitypartyTo;
>> > email.from = activitypartyFrom;
>> > email.subject = "This is a test";
>> >
>> > I am getting conversion issues of arraylists and activityparty types.
>> > I
>> > understand this error, but cannot seem to figure out how to resolve it.
>> > Can
>> > someone post me an example code of how to create and send an e-mail
>> > programmatically in CRM v3.0.
>> >
>> > Regards,
>> > Keener
>> >
>> >
>>
>>
>>