How to retrieve dynamic marketing list member in Dynamics CRM 2011

To retrieve dynamic marketing list member in Dynamics CRM 2011 follow below steps:

  • Pass list Guid as string and it will return dynamic marketing list member
private EntityCollection RetrieveDynamicMemberList(IOrganizationService service, string strList)
        {          
            ColumnSet cols = new ColumnSet(new string[] { "query" });

            // GUID of the Dynamic Marketing List
            var entity = service.Retrieve("list", new Guid(strList), cols);
            var dynamicQuery = entity.Attributes["query"].ToString();          
            EntityCollection dynamicmemberec = service.RetrieveMultiple(new FetchExpression(dynamicQuery));
            return dynamicmemberec;
        }
This entry was posted in MS CRM 2011 and tagged , . Bookmark the permalink.

Leave a Reply

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