Hi,
I need to retrieve members of a marketing list but i have no idea how?
Thank you for all answers.
*This post is locked for comments
Hi,
I need to retrieve members of a marketing list but i have no idea how?
Thank you for all answers.
*This post is locked for comments
Hi,
What is purpose of this lines? Actually there are some typo-faults and wrong usage inside.
Entity description = new Entity("campaign"); description["description"] = "Tu bodo napisani memberji"; description["descriptio"] = "Tu bodo napisani memberji"; memberGuids.Add("Jhon Doe");
I dont get any error's all goes through fine. Problem is that
EntityCollection entityCollection = service.RetrieveMultiple(query); Entity description = new Entity("campaign");
entityCollection seems to be empty and I dont know reason why.
Hi
What is the error you are getting?
Please provide the details.
Ok i used this code but something is wrong and i dont know what(not best at debuging) i dont get anything to Array.
Code:
using Microsoft.Xrm.Sdk; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Xrm.Sdk.Query; using System.Collections; using Microsoft.Xrm.Sdk.Client; using System.ServiceModel.Description; namespace PluginMARetriveMembers { public class PlugInEvent : IPlugin { //public IOrganizationService OrganizationService { get; private set; } public void Execute(IServiceProvider serviceProvider) { //definition of context and services IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); IOrganizationServiceFactory servicefactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); IOrganizationService client = servicefactory.CreateOrganizationService(context.UserId); IOrganizationService service = (IOrganizationService)servicefactory.CreateOrganizationService(context.UserId); ArrayList memberGuids = new ArrayList(); // IOrganizationService orgService = OrganizationService; PagingInfo pageInfo = new PagingInfo(); pageInfo.Count = 5000; pageInfo.PageNumber = 1; QueryByAttribute query = new QueryByAttribute("members"); // GUID to static market list query.AddAttributeValue("listid", new Guid("9396465b-bf06-e711-80e3-3863bb358c80")); query.ColumnSet = new ColumnSet(true); EntityCollection entityCollection = service.RetrieveMultiple(query); Entity description = new Entity("campaign"); description["description"] = "Tu bodo napisani memberji"; description["descriptio"] = "Tu bodo napisani memberji"; memberGuids.Add("Jhon Doe"); foreach (Entity entity in entityCollection.Entities) { memberGuids.Add(((EntityReference)entity.Attributes["entityid"]).Id); } Console.WriteLine("!TEST!"); // more than 5000 contacts while (entityCollection.MoreRecords) { query.PageInfo.PageNumber += 1; query.PageInfo.PagingCookie = entityCollection.PagingCookie; entityCollection = service.RetrieveMultiple(query); foreach (Entity entity in entityCollection.Entities) { memberGuids.Add(((EntityReference)entity.Attributes["entityid"]).Id); } } } } }
Hi,
You can retrieve your list members without regarding to your list type (dynamic or static) with XrmLibrary (download from NuGet)
ListHelper helper = new ListHelper(_organizationService); var members = helper.GetMemberList(Guid.Parse("YOUR MARKETING LIST ID")); //this returns "ListMemberResult" class foreach (var item in members.Data) { Guid id = item.Id; string fullname = item.Name; //If your membertype is Contact or Lead this will be "FULLNAME", if membertype is Account this will be "NAME" }
get entityid column from list member entity. This would be the Entity Reference of contact associated with that list member.
Hi ,
You need to get members according to your list id.
Ok, thank you for all answers. I have a new problem now, i got all members but now I need to get contacts from members who are in marketing list, any ideas?
André Arnaud de Cal...
292,516
Super User 2025 Season 1
Martin Dráb
231,356
Most Valuable Professional
nmaenpaa
101,156