Which code segment should you use?

You create an application for a Microsoft Office SharePoint Server 2007 server. You need to write code that retrieves all users for an audience named Audience1. Which code segment should you use?

You create an application for a Microsoft Office SharePoint Server 2007 server. You need to write code that retrieves all users for an audience named Audience1. Which code segment should you use?

A.
AudienceManager audMgr = new AudienceManager();
AudienceCollection audiences = audMgr.Audiences;
Audience audience1 = audiences[“Audience1”];

B.
AudienceManager audMgr = new AudienceManager();
ArrayList membershipList =
audMgr.Audiences[“Audience1”].GetMembership();

C.
AudienceManager audMgr = new AudienceManager();
AudienceCollection audience1 = audMgr.Audiences;

D.
SPSite site = new SPSite(“http: //servername//sites/site1”);
ServerContext context = ServerContext.GetContext(site);
AudienceManager audMgr = new AudienceManager(context);
SPWeb web = site.AllWebs[0];
ArrayList audienceIDNames =
audMgr.GetUserAudienceIDs(“Audience1”, true, web);



Leave a Reply 0

Your email address will not be published. Required fields are marked *