Wednesday, December 21, 2011

User Profile Synchronization between SharePoint 2010 and Domino Lotus


Sorry..... if you are looking for a configuration based solution. After much research I ended up writing a windows service using directory service APIs.
It's not that bad actually...

DirectoryEntry root = new DirectoryEntry(_ldaplocation, _serviceUserName, _servicePassword, AuthenticationTypes.ServerBind)
DirectorySearcher searcher = new DirectorySearcher(root);
searcher.Filter = string.Format("(&(objectClass=person)(businesscategory={0}))", businessCategory);
SearchResultCollection results = searcher.FindAll();
foreach (SearchResult result in results)// process each user
{
string searchpath = result.Path;
ResultPropertyCollection rpc = result.Properties;
ProcessUser(rpc);// you got your properties
}
ProcessUser(...)
{
Microsoft.Office.Server.UserProfiles.UserProfile newProfile = profileManager.CreateUserProfile(userID,PreferredName);
newProfile [PropertyConstants.FirstName].Add("FirstName");
newProfile [PropertyConstants.LastName].Add("LastName");
newProfile.Commit();
}

you can use BDC for this purpose as well.

Note : If this helped you, please add a comment and share the link as it will motivate me to post more solutions like this.

No comments:

Post a Comment