locked
How to identify the Contacts and users RRS feed

  • Question

  • Hai Experts

     

    I have a problem.

    In one of my text box i am having a group of GUID which may be of type contact or systemuser.

    eg, de1e6fac-8221-dd11-837b-00137263ee97,54ee6b9b-a621-dd11-837b-00137263ee97,c8f09667-188d-dc11-bbf0-00137263ee97,fdd8309a-4c5d-db11-8737-00137263ee97,0dd9309a-4c5d-db11-8737-00137263ee97

     

    I need to add these GUID to email reciepents. So i have created a activity pointer array

    ap[0] = new activityparty();
    ap[0].partyid = new Lookup();
    ap[0].partyid.type = EntityName.systemuser.ToString();
    ap[0].partyid.Value = new Guid("81903B1D-428E-DD11-BF80-005056B02654");

     

    in this i need to specify whether its a systemuser or contact.

    Hence i need to split the GUID of the system users and contact induvidually.

     

    Is there any easy method for this?

     

    Thanks in Advance

    Vinoth

     

     

     

    Monday, January 12, 2009 11:37 AM

Answers

  • There's no easy way to do this. Ideally in your text box you would store the entity type along with the Guid. Otherwise your only option is to try a Retrieve using the guid on the entity type to see if there is a corresponding record

     

    Monday, January 12, 2009 11:57 AM
    Moderator

All replies

  • There's no easy way to do this. Ideally in your text box you would store the entity type along with the Guid. Otherwise your only option is to try a Retrieve using the guid on the entity type to see if there is a corresponding record

     

    Monday, January 12, 2009 11:57 AM
    Moderator
  • the solution:


    contact newcontact = new dmcrm.contact();
    TargetRetrieveContact target = new TargetRetrieveContact();
    target.EntityId = new Guid("81903B1D-428E-DD11-BF80-005056B02654");
    RetrieveRequest req = new RetrieveRequest();
    req.Target = target;
    req.ReturnDynamicEntities = false;
    req.ColumnSet = new AllColumns();
    RetrieveResponse res = (RetrieveResponse)service.Execute(req);
    newcontact  = (contact)res.BusinessEntity;

    if (newcontact = null)
    {

    ap[0] = new activityparty();
    ap[0].partyid = new Lookup();
    ap[0].partyid.type = EntityName.systemuser.ToString();
    ap[0].partyid.Value = new Guid("81903B1D-428E-DD11-BF80-005056B02654");


    }
    else
    {

    ap[0] = new activityparty();
    ap[0].partyid = new Lookup();
    ap[0].partyid.type = EntityName.contact.ToString();
    ap[0].partyid.Value = new Guid("81903B1D-428E-DD11-BF80-005056B02654");


    }


    Tuesday, January 13, 2009 8:21 AM