{"id":204,"date":"2009-05-07T09:30:00","date_gmt":"2009-05-07T04:00:00","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=204"},"modified":"2009-05-07T09:30:00","modified_gmt":"2009-05-07T04:00:00","slug":"retrieve-marketing-list-members","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2009\/05\/retrieve-marketing-list-members\/","title":{"rendered":"Retrieve Marketing List Members"},"content":{"rendered":"<div align=\"justify\"><span>A Marketing list in CRM, can be a collection accounts or contacts or leads. Retrieving the members of a  marketing list is not as as simple. We just realized that the list member entity only stores the link to the entity and  Retrieve method is not supported by this entity.<\/p>\n<p>Hence to retrieve the list members for a given entity we need to identify the type of entity being supported by the list i.e Leads\/Accounts\/Contacts and then using the link entity functionality link it with the listmember entity to get the list.<\/p>\n<p>Following is the snippet of getting collection of accounts from a particular marketing list id.<\/p>\n<p>             \/\/initialize QueryExpression for adding link entities<br \/>            QueryExpression qe = new QueryExpression();<br \/>            qe.EntityName = EntityName.account.ToString();<br \/>            \/\/Initialize columnset<br \/>            ColumnSet col = new ColumnSet();<\/p>\n<p>            \/\/add columns to columnset for the acc to retrieve each acc from the acc list<br \/>            col.AddColumns(new string[] { &#8220;accountid&#8221;, &#8220;name&#8221;, &#8220;address1_line1&#8221;, &#8220;address1_line2&#8221;, &#8220;address1_city&#8221;, &#8220;address1_stateorprovince&#8221;, &#8220;address1_postalcode&#8221;});<\/p>\n<p>            qe.ColumnSet = col;<\/p>\n<p>            \/\/ link from account to listmember<br \/>            LinkEntity le = new LinkEntity();<br \/>            le.LinkFromEntityName = <\/span><span><span><strong>EntityName.account.ToString();<br \/><\/strong>            le.LinkFromAttributeName = &#8220;accountid&#8221;;<br \/>            le.LinkToEntityName = <strong>EntityName.listmember.ToString();<\/strong><br \/>            le.LinkToAttributeName = &#8220;entityid&#8221;;<\/p>\n<p>            \/\/link from listmember to list<br \/>            LinkEntity le2 = new LinkEntity();<br \/>            le2.LinkFromEntityName = EntityName.listmember.ToString();<br \/>            le2.LinkFromAttributeName = &#8220;listid&#8221;;<br \/>            le2.LinkToEntityName = EntityName.list.ToString();<br \/>            le2.LinkToAttributeName = &#8220;listid&#8221;;<\/p>\n<p>            \/\/ add condition for listid<br \/>            ConditionExpression ce = new ConditionExpression();<br \/>            ce.AttributeName = &#8220;listid&#8221;;<br \/>            ce.Operator = ConditionOperator.Equal;<br \/>            ce.Values = new object[] { strList };\/\/here \u201cstrList\u201d is the marketing list id provided to this function.<\/p>\n<p>            \/\/add condition to linkentity<br \/>            le2.LinkCriteria = new FilterExpression();<br \/>            le2.LinkCriteria.Conditions.Add(ce);<\/p>\n<p>            \/\/add  linkentity2 to linkentity<br \/>            le.LinkEntities.Add(le2);<\/p>\n<p>\/\/add linkentities to Query Expression which is passed for getting collection of accounts<br \/>            qe.LinkEntities.Add(le);<\/p>\n<p>            \/\/above query expression is passed to retrieve multiple for getting BusinessEntityCollection of accounts.<br \/>            BusinessEntityCollection bec = service.RetrieveMultiple(qe);<\/p>\n<p>Similarly you could link with Contacts\/Leads to get the list of members from a Contact\/Lead Marketing list.<\/span><\/span><\/div>\n<p><span><\/span><br \/><span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A Marketing list in CRM, can be a collection accounts or contacts or leads. Retrieving the members of a marketing list is not as as simple. We just realized that the list member entity only stores the link to the entity and Retrieve method is not supported by this entity. Hence to retrieve the list\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2009\/05\/retrieve-marketing-list-members\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[19],"tags":[1079,1464],"class_list":["post-204","post","type-post","status-publish","format-standard","hentry","category-dynamics-crm","tag-marketing-lists","tag-retrieve"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/204","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=204"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/204\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=204"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}