Robert MacLean
Robert MacLean

Reputation: 39261

Get audience members using web services in SharePoint

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?

Upvotes: 0

Views: 1041

Answers (1)

Robert MacLean
Robert MacLean

Reputation: 39261

Short answer, there is no web service :(

In the end I took the code from the question and built a web service myself and then use that.

Upvotes: 1

Related Questions