Which code segment should you use?

You create a Microsoft Office SharePoint Server 2007 application. The application has a user named UserA.

You need to retrieve a list of colleagues for UserA.

Which code segment should you use?

You create a Microsoft Office SharePoint Server 2007 application. The application has a user named UserA.

You need to retrieve a list of colleagues for UserA.

Which code segment should you use?

A.
private void RetrieveColleagues(ServerContext Cntxtobj)
{

SPSite site = new SPSite(“http: //servername/sites/site1”);
UserProfileManager profileManager =
new UserProfileManager( Cntxtobj );
UserProfile profile =
profileManager.GetUserProfile(“abc\\UserA”);
Colleague[] colleagues = profile.Colleagues.GetItems();
Site.Dispose();

}

B.
private void RetrieveColleagues(ServerContext Cntxtobj)
{

SPSite site = new SPSite(“http: //servername/sites/site1”);
ServerContext context = ServerContext.GetContext(site);
UserProfileManager profileManager =
new UserProfileManager(context);
UserProfile profile =
profileManager.GetUserProfile(“abc\\UserA”);
UserProfile[] colleagues =
profile.Colleagues.GetCommonColleagues();
Site.Dispose();

}

C.
private void RetrieveColleagues(ServerContext Cntxtobj)
{

SPSite site = new SPSite(“http: //servername/sites/site1”);
ServerContext context = ServerContext.GetContext(site);
UserProfileManager profileManager =
new UserProfileManager(context);
UserProfile profile =
profileManager.GetUserProfile(“abc\\UserA”);
ColleagueManager manager = new ColleagueManager(profile);
UserProfile[] profiles = manager.GetColleaguesOfColleagues();
Site.Dispose();

}

D.
private void RetrieveColleagues(ServerContext Cntxtobj)
{

SPSite site = new SPSite(“http: //servername//sites/site1”);
ServerContext context = ServerContext.GetContext(site);
AudienceManager audMgr = new AudienceManager(context);
SPWeb web = site.AllWebs [“mainpage”] ;
ArrayList audienceIDNames =
audMgr .GetUserAudienceIDs(“domain\\userA”, true, web);
Site.Dispose();

}



Leave a Reply 0

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