70-542 Free Dumps Study Materials
Question 6: You are creating a Microsoft Office SharePoint Server 2007 site.
You create a Microsoft WinForms application to enter information about a user.
You write the following code segment. (Line numbers are included for reference only.)
01 Shared Sub AddUser(ByVal user_name As String())
02 ' Using
03 Dim site As SPSite = New SPSite("http://sitename")
04 Try
05 Dim context As ServerContext = _
06 ServerContext.GetContext(site)
07 Dim profileManager As UserProfileManager = New _
08 UserProfileManager(context)
09 ...
10 Finally
11 CType(site, IDisposable).Dispose()
12 End Try 13 End Sub
You need to add a user profile to the profile store.
Which code segment should you insert at line 09?
A. Private u As UserProfile = _
profileManager.GetUserProfile(user_name)
...
B. Private profileManager As UserProfileManager = New _
UserProfileManager(context)
Private u As UserProfile = profileManager.GetUserProfile(user_name)
...
u.Commit
C. Private user_name As String = "<UserProfile>"
...
user_name += userProfile + user_name
...
user_name += "</UserProfile>"
profileManager.CreateUserProfile(user_name)
D. Private u As UserProfile = _
profileManager.CreateUserProfile(user_name)
...
u.Commit
Correct Answer: D