You create a SharePoint Server 2007 application. The application contains a user named UserA. You need to write a code segment to add the user to the user profile store.
Which code segment should you use?
A.
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 account As String = “abc/UserA”
Dim changeToken As UserProfileChangeToken = ProfileManager.CurrentChangeToken Dim profile As UserProfile = ProfileManager.GetUserProfile(account) Dim changes as UserProfileChangeCollection = ProfileManager.GetChanges(changeToken) site.Dispose
B.
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 account As String = “abc/UserA”
Dim profile As UserProfile = ProfileManager.GetUserProfile(account) site.Dispose
C.
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 account As String = “abc/UserA”
Dim profile As UserProfile = ProfileManager.CreateUserProfile(account) site.Dispose
D.
Dim site As SPSite = New SPSite(“http://servername/sites/site1”) Dim context As ServerContext = ServerContext.GetContext(site)
Dim account As String = “abc/UserA”
site.rootWeb.Users.Add(account,”, `’, `’)
site.Dispose