简体   繁体   中英

How to Get list of departments in user profile from SharePoint?

How to get list of departments in user profiles from SharePoint?

I have got a list of departments of user profile by getting into each profile in SharePoint and archiving the department property value of each. But it becomes slow when number of user profiles increase because of getting into each profile for department by using for each loop.

So what I would like to know, is there any way to get this list of departments from user profile. I am using C#.

I'm not sure that there is any such functionality. I would suggest you: 1) Query Active Directory to get all values of department field (if user profiles are retrieved from AD). 2) Write custom web service which queries sharepoint databases directly (unfortunately querying sharepoint databases is not recommended so you probably won't find any documentation). 3) Cache department list and try to use GetChanges() method of UserProfileManager class to get changes and save them to cache (or update cache completely after some time).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM