Showing posts with label Phone call creation by coding. Show all posts
Showing posts with label Phone call creation by coding. Show all posts

Tuesday, June 28, 2011

Creating phonecall


The main issue you will face in this case is assigning 'to' value to phonecall.

1. For 4.0

//first create the activityparty type object like
activityparty toActivity = new activityparty();
//Then assign partyid
toActivity.partyid = new Lookup("contact", contactID);
//Assign that activitypartyobject to 'to' of phone call.
phncall.to = new activityparty[] { toActivity };
service.Create(phncall);



2. For 2011

Guid contactID = new Guid("A11111F7-208C-E011-B5F4-000C29FABFAC");
PhoneCall phncall = new PhoneCall();
//first create the activityparty type object like
ActivityParty toActivity = new ActivityParty();
//Then assign partyid
toActivity.PartyId = new EntityReference("contact", contactID);
//Assign that activitypartyobject to 'to' of phone call.
phncall.To = new ActivityParty[] { toActivity };
service.Create(phncall);


It will work.
If any issue just let me know.
thanks