1

I am building new SharePoint solution that contains module with large number of items as well as complex relations so I decided to save all the data into custom database

I need to relate some records in the custom database to users given that the users are active directory users.

Would you kindly advice the best way to save the users in the DB considering that I need to build reports that shows the users names

Thanks in advance

1

Hossam,

I will suggest you save everything i.e. User Login Name (SPUser.LoginName), User Display Name (SPUser.Name) and User ID (SPUser.ID)

Few considerations here:

  • Since you have your Custom Database, saving just the User ID field (SPUser.ID) will not be useful

  • Since User IDs are saved in User Information List, you should not depend on it.. Since it will be different if the site collection changes

  • Users might change their Display Names (or admin may), in this case your database will be using Old Display Names (You can skip User Display Name in database, but than you will need to fetch the User Display Name from SharePoint or Active Directory)

7
  • I like your answer, but what if the user login name changed ? Feb 7 '14 at 6:28
  • User Login Names are Active Directory accounts like ActiveDirectoryName\UserName, I don't think AD accounts change frequently! Feb 7 '14 at 13:43
  • I have done the following, created table with all user information including the guid of the user on active directory, then I have created job to run to loop over all users and update displayname,loginname, using the guid of the active directory, what do you think Feb 11 '14 at 5:46
  • How do you get the Guid of Active Directory from SharePoint? AFAIK, you can only get Login Name..? Feb 11 '14 at 6:24
  • I catch the login name from sharepoint then connect to active directory to get the guid of that login name I will share that code when I finish :) Feb 11 '14 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.