Get audience members using web services in SharePoint

Posted by Robert MacLean on Stack Overflow See other posts from Stack Overflow or by Robert MacLean
Published on 2010-05-10T10:57:40Z Indexed on 2010/05/10 11:04 UTC
Read the original article Hit count: 466

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about sharepoint

Related posts about web-services