Do you want to update the value of a User Profile property in your SharePoint environment programatically? (For example, changing the value of 'Office' from 'Office A' to 'Office B'). You can use the following method to achieve this. Just pass the User Name, name of the property to be updated and the value that needs to be updated as parameters for this method.
Ex: UpdateProfilePropertyValue("MyServer\\TestUser","Office","Office B");
This is applicable both for OOTB properties and custom properties.
Note:
Reference to the DLL 'Microsoft.Office.Server.dll' (c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.Office.Server.dll) and the following using directives are required.
using Microsoft.Office.Server;
using Microsoft.Office.Server.UserProfiles;

No comments:
Post a Comment