70-542 Free Dumps Study Materials
Question 7: 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 Sub RetrieveColleagues(ByVal Cntxtobj As ServerContext)
...
Dim site As SPSite = New SPSite("http: //servername/sites/site1")
Dim profileManager As UserProfileManager = New _
UserProfileManager(Cntxtobj) Dim profile As UserProfile = _
profileManager.GetUserProfile("abc\UserA")
Dim colleagues As Colleague() = profile.Colleagues.GetItems
Site.Dispose
...
End Sub
B. Private Sub RetrieveColleagues(ByVal Cntxtobj As ServerContext)
...
Dim site As SPSite = New SPSite("http: //servername/sites/site1")
Dim context As ServerContext = ServerContext.GetContext(site)
Dim profileManager As UserProfileManager = New _
UserProfileManager(context) Dim profile As UserProfile = _
profileManager.GetUserProfile("abc\UserA")
Dim colleagues As UserProfile() = _
profile.Colleagues.GetCommonColleagues
Site.Dispose
...
End Sub
C. Private Sub RetrieveColleagues(ByVal Cntxtobj As ServerContext)
...
Dim site As SPSite = New SPSite("http: //servername/sites/site1")
Dim context As ServerContext = ServerContext.GetContext(site)
Dim profileManager As UserProfileManager = New _
UserProfileManager(context) Dim profile As UserProfile = _
profileManager.GetUserProfile("abc\UserA")
Dim manager As ColleagueManager = _
New ColleagueManager(profile)
Dim profiles As UserProfile() = _
manager.GetColleaguesOfColleagues
Site.Dispose
...
End Sub
D. Private Sub RetrieveColleagues(ByVal Cntxtobj As ServerContext)
...
Dim site As SPSite = New SPSite("http: //servername//sites/site1")
Dim context As ServerContext = ServerContext.GetContext(site)
Dim audMgr As AudienceManager = New AudienceManager(context)
Dim web As SPWeb = site.AllWebs("mainpage")
Dim audienceIDNames As ArrayList = _
audMgr.GetUserAudienceIDs("domain\userA", True, web)
Site.Dispose
...
End Sub
Correct Answer: A