Code:
using (SPSite spSite = new SPSite(@"http://localhost"))
{
ServerContext siteContext = ServerContext.GetContext(spSite);
AudienceManager amManager = new AudienceManager(siteContext);
string strName = "HR Department";
Audience oAudience = amManager.Audiences[strName];
ArrayList oAudienceMembers = oAudience.GetMembership();
foreach (UserInfo oUser in oAudienceMembers)
{
Console.WriteLine(oUser.PreferredName);
Console.WriteLine(oUser.NTName);
Console.WriteLine(oUser.Email);
}
}
0 comments:
Post a Comment