Friday, April 03, 2009

Set Manager Profile property value

To assign manager from one profile to another, you could not set it directly. You need to convert the Source Manager profile to a UserProfile object and then assign the account name to the destination profile manager’s property.

UserProfileManager upManager;
UserProfile sourceProfile,

string managerId = sourceProfile["manager"].Value.ToString();

if (upManager.UserExists(managerId))


UserProfile managerProfile = upManager.GetUserProfile(managerId);

destProfile["manager"].Value = managerProfile["Accountname"].Value;