Extracting list of users from SharePoint 2010
July 4, 2014 Leave a comment
There are loads of ways you can do this with web services etc… but I have found the easiest way is to query the backend database.
Find you database for the user profiles (might be called something like ‘ProfileDB’), and in there you will find a table called UserProfile_Full.
In my case today I needed to obtain a list of all staff and their managers, so I ran the following query to get this…
SELECT a.PreferredName,
a.Email,
b.PreferredName as Manager
FROM dbo.UserProfile_Full a
left join dbo.UserProfile_Full b
ON a.Manager = b.NTName