Setting From & To Partylist for Activities

If we are creating activity like email,phonecall, letter,fax we need to set sender & recipient activityparty. we can set activitypart using following code

 I am creating letter activity

DynamicEntity LetterAct = new DynamicEntity(“letter”);

//create regardingobjectid
LookupProperty _Regarding = new LookupProperty();
_Regarding.Name = “regardingobjectid”;
_Regarding.Value = new Lookup(“regarding entity name”,GUID of entity instance);

//set from and to
 DynamicEntity[] _ActivityParties = new DynamicEntity[1];

_ActivityParties[0] = new DynamicEntity();

_ActivityParties[0].Name = “activityparty”;

PropertyCollection _ActivityPartyCollection= new PropertyCollection();

_ActivityPartyCollection.Add(new LookupProperty(“partyid”, new Lookup(“Set Lookup type here for recipient”,GUID of recipient)));

_ActivityParties[0].Properties = _ActivityPartyCollection;

LetterAct.Properties.Add(new DynamicEntityArrayProperty(“to”, _ActivityParties));

DynamicEntity[] _ActivityPartiesFrm = new DynamicEntity[1];

_ActivityPartiesFrm[0] = new DynamicEntity();

_ActivityPartiesFrm[0].Name = “activityparty”;

PropertyCollection ActivitypartyFrm = new PropertyCollection();

LetterAct.Add(new LookupProperty(“partyid”, new Lookup(“Set Lookup type here for sender”, GUID of Sernder)));

_ActivityPartiesFrm[0].Properties = ActivitypartyFrm;

LetterAct.Properties.Add(new DynamicEntityArrayProperty(“from”, _ActivityPartiesFrm));

TargetCreateDynamic targetCreate = new TargetCreateDynamic();

targetCreate.Entity = LetterAct;

// Create the request object.

CreateRequest create = new CreateRequest();

// Set the properties of the request object.

create.Target = targetCreate;

// Execute the request.

CreateResponse created = (CreateResponse)_Service.Execute(create);



Filed under Uncategorized

9 responses to “Setting From & To Partylist for Activities

  1. Pingback: 2010 in review « Mahender Pal

  2. Hi,
    How to program owner and partylist types when generating campaign response after creating contact?

    • mahenderpal

      Hi Pawan,
      Could you provide some more information about your requirement.

      • Pawan

        The form is to be used to create a database of constituents who wish to receive e-invitations to Centre meetings, our newsletters and exclusive invitations to our events

  3. Pawan

    And also generate their campaign response.

    • mahenderpal

      I am still not clear but if you have custom aspx page and you are want to set owner for your campaingrespose record, you can use your system user which you are using to connect to MS CRM 2011 service and to set partylist you need entity record from CRM, so if you have contact exist in CRM you get it to set in partylist.

  4. Pawan

    but i don’t know the c# code to set partylist and owner values. pls give me a sample code for setting a value to partylist property, owner property and also tell that how we can add these properties to dynamic entities in c# for crm 4.0.

  5. Great goods from you, man. I have take into account your stuff
    prior to and you are just too fantastic. I actually like what you have acquired here,
    really like what you are stating and the way in which
    you say it. You are making it enjoyable and you continue to care for to keep it wise.

    I can’t wait to learn much more from you. This is actually a tremendous web site.

  6. You’re so awesome! I do not think I’ve truly read
    through something like this before. So great
    to find somebody with original thoughts on this subject matter.
    Seriously.. many thanks for starting this up. This site is
    something that’s needed on the internet, someone with a little originality!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s