Tuesday, July 24, 2012

Query that retrieve User Profile properties of a specific SharePoint 2010 user

Have you ever thought of a query that retrieve User Profile properties of a specific SharePoint 2010 user?


I have been searching for this guy for long ... today I found it.



SELECT  userprof.NTName,  proplist.PropertyName,  usrprofval.PropertyVal 
 FROM [<<ProfileDB>>].[dbo].[UserProfile_Full] userprof WITH(NOLOCK)
 JOIN  [<<ProfileDB>>].[dbo].[userProfileValue] usrprofval 
     ON  usrprofval.RecordID =  userprof.RecordID
 JOIN  [<<ProfileDB>>].[dbo].[PropertyList]     proplist  
     ON  proplist.PropertyID =  usrprofval.PropertyID 
WHERE  userprof .NTName = '<<windowsID>>'


Note: Reading from the SharePoint databases programmatically, or manually, can cause unexpected locking within Microsoft SQL Server which can adversely affect performance.

No comments:

Post a Comment