SharePoint Tips #25: Beware of User Profile Import

Among SharePoint 2007’s User Profile features, one of the most useful is the Profile Import. This feature allows you to import existing user accounts from Active Directory, an LDAP server or the Business Data Catalog, to the User Profile Store. Even better, it allows you to map the User Profile properties to user account properties (from Active Directory, for instance) so that they’re automatically imported. Additionally, you can schedule regular imports so that SharePoint’s User Profile is kept in sync with Active Directory’s user account.

Needless to say, this can save you a lot of time, especially if you already have a large base of users with a few populated properties on Active Directory. This is, however, a one way process, that is, only from the Directory to SharePoint, never the other way around.

One question you might be asking is: what if I update a User Profile on SharePoint, putting new data on a mapped property and then a Profile Import occurs?

The answer to this is not straightforward, because it depends on your answer to one or two questions.

Question 1: In Active Directory (or LDAP server), does the mapped property have a value?

If so, then the value in SharePoint’s User Profile property will get overwritten by the one in the directory’s user account property. No need to check Question 2.

If not, then check Question 2.

Question 2: Did you update the User Profile using SharePoint’s UI, or using the API?

If you used the SharePoint’s UI then the User Profile property will retain the value, since the mapped property in the directory service has no value to replace it.

If you used the API, the Profile Import will clear the value of the mapped property on SharePoint’s User Profile. I cannot explain why this difference exists, but I have seen it happen.

Conclusion: If you are updating User Profile properties by using SharePoint’ API, make sure you remove their mappings (to directory services’ properties) to prevent you from losing data when the Profile Import executes.