Nov
1
Written by:
Oscar Meszar
11/1/2009 7:04 PM
First we’re going to open a site:
using (SPSite site = new SPSite(“http://localhost”))
{
All the Code below is inside this using statement
}
Next we’re going to get Server Content for the site.
Microsoft.Office.Server.ServerContext Context = ServerContext.GetContext(site);
Next we get a User Profile Manager
Microsoft.Office.Server.UserProfiles.UserProfileManager Mngr = new UserProfileManager(Context);
Now I’m going to retreive a particular user using the user’s account
Microsoft.Office.Server.UserProfiles.UserProfile Profile = Mngr.GetUserProfile(“litwareinc\brianb”);
Now that I have a user profile, I can query the information in it, and modify it if I choose:
System.Console.Write(Profile[“Title”].Value.ToString());
Profile[“Title”].Value = “New Title”;
Don’t forget the Commit if you want to modify the data.
Profile.Commit();
That's it. How brianb has a "New Title".
Tags:
1 comment(s) so far...
Re: Update User Profiles in SharePoint 2007 from C#
This article gives the light in which we can observe the reality. this is very nice one and gives in depth information. thanks for this nice article Good post.....Valuable information for all.I will recommend my friends to read this for sure... Thanks....
By liste de casinos recommandes on
6/2/2010 7:13 AM
|