locked
Dynamics CRM 2011 - how to join ContactSet to Marketing List RRS feed

  • Question

  • Hi,

    We are using Dynamics CRM 2011, and I am connecting to the database through the CRM SDK with LINQ.

    I want to be able to see what Marketing List's my Contact is joined to. I am using the sample code from the SDK (note there is more code for authentication to the server which I am not including here):


    OrganizationServiceProxy _serviceProxy;

    IOrganizationService _service;

    ServiceContext svcContext = new ServiceContext(_service);

    Then I can see all the contacts in "svcContext.ContactSet", and I can also see all the Marketing List in "svcContext.ListSet".

    However I am not sure how to join the two tables together. I notice there is "svcContext.ListMemberSet" but I cannot find the link in there which tells me which Contact is in the Marketing List.

    Is there another intermediary table which joins them together? Any help would be appreciated.

    Thanks.

    David

    Thursday, September 19, 2013 2:08 AM

Answers

  • David,

    You should be able to join the listmember and contact using the entityid & contactid. Based on the EntityType, the EintityId will point to a lead/contact/account.


    If my response helps you in finding your answer then please click 'Mark as Answer' and 'Vote as Helpful'

    • Marked as answer by David Aston Thursday, September 19, 2013 6:19 AM
    Thursday, September 19, 2013 2:41 AM

All replies

  • David,

    You should be able to join the listmember and contact using the entityid & contactid. Based on the EntityType, the EintityId will point to a lead/contact/account.


    If my response helps you in finding your answer then please click 'Mark as Answer' and 'Vote as Helpful'

    • Marked as answer by David Aston Thursday, September 19, 2013 6:19 AM
    Thursday, September 19, 2013 2:41 AM
  • http://mileyja.blogspot.com.au/2011/11/add-multiple-entities-members-to.html

    C#

    AddListMembersListRequest req = new AddListMembersListRequest(); req.ListId = new Guid("6CAC04FC-930F-E111-8DB2-1CC1DEF1B5FF"); //add the new list of marketing list memnbers req.MemberIds = new System.Guid[2]; req.MemberIds[0] = new Guid("DCB265C9-5F0C-E111-BF0B-1CC1DEE89AA8"); req.MemberIds[1] = new Guid("E4B265C9-5F0C-E111-BF0B-1CC1DEE89AA8"); AddListMembersListResponse resp = (AddListMembersListResponse)service.Execute(req);

    • Edited by Jian_H Thursday, September 19, 2013 3:21 AM
    Thursday, September 19, 2013 3:21 AM
  • Thanks I will have a look at that
    Thursday, September 19, 2013 6:19 AM
  • Thanks for the info.
    Thursday, September 19, 2013 6:19 AM