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);
LetterAct.Properties.Add(_Regarding);

//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);

9 thoughts on “Setting From & To Partylist for Activities

  1. Pingback: 2010 in review « Mahender Pal

      1. 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

        Reply
    1. mahenderpal Post author

      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.

      Reply
  2. 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.
    Thanks.

    Reply
  3. Miriam

    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.

    Reply
  4. porta potty rental Killeen

    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!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *