Get audience members using web services in SharePoint
- by Robert MacLean
Using the SharePoint API (the one with the assemblies you add, but requires you to run on the server) it is easy to get audience members:
using (SPSite site = new SPSite("http://localhost"))
{
ServerContext svrContext = ServerContext.GetContext(site);
AudienceManager audManager = new AudienceManager(svrContext);
foreach (Audience audience in audManager.Audiences)
{
ArrayList people = audience.GetMembership();
if (people != null)
{
foreach (UserInfo user in people)
{
Console.WriteLine("send email to " + user.Email);
}
}
}
However I can not find a web service to do the same thing?