User Profile App User Report Query SharePoint 2010

SELECT
[Login] = upf.NTName,
Name = upf.PreferredName,
Email = upf.Email,
Modified = upf.LastUserUpdate,
Property = pl.PropertyName,
Value = upv.PropertyVal
FROM
UserProfile_Full upf left join UserProfileValue upv
on upv.RecordID = upf.RecordID
left join PropertyList pl on pl.PropertyID = upv.PropertyID
order by PreferredName

The query that will return users who don’t have their About Me section complete…
SELECT
Name = [UserProfile_Full].PreferredName,
Email = [UserProfile_Full].Email,
Link  = 'http://yoursite/Person.aspx?accountname=' + NTName,
NTName
FROM [User Profile Service Application_ProfileDB_22d7956d794a4d9a8e898fd8700a866d].[dbo].[UserProfile_Full]
where RecordID not in
(
select upf.RecordID from
UserProfile_Full upf left join UserProfileValue upv
on upv.RecordID = upf.RecordID
left join PropertyList pl on pl.PropertyID = upv.PropertyID
where  PropertyName = 'AboutMe' and DATALENGTH(upv.PropertyVal) > 8)
and Email is not null
order by Name


The query that will obtain users that don’t have a picture…
SELECT
Name = [UserProfile_Full].PreferredName,
Email = [UserProfile_Full].Email,
NTName
FROM [User Profile Service Application_ProfileDB_22d7956d794a4d9a8e898fd8700a866d].[dbo].[UserProfile_Full]
WHERE PictureUrl IS NULL

(!) - by request
SELECT
Name = [UserProfile_Full].PreferredName,
Email = [UserProfile_Full].Email,
NTName,
PictureUrl
FROM [User Profile Service Application_ProfileDB_22d7956d794a4d9a8e898fd8700a866d].[dbo].[UserProfile_Full]
WHERE PictureUrl IS not NULL and PictureUrl != ''

Comments

Popular posts from this blog

Metastorm - Open form in an action from a list or link

Corporate Intranet Information Architecture – a Publishing Site

No Search Results in SharePoint Contextual Search OSSSearchResults.aspx