ユーザーProfileManagerを使用して特定のユーザーに報告するすべてのユーザーのリストを取得できますか?
-
09-12-2019 - |
質問
UserProfileManagerクラスにはMethod GetManager()がユーザプロファイルからプルダリングするメソッドgetManager()がありますが、現在特定のユーザーに報告しているすべてのユーザーのリストを返すものはわかりません。回避策があるかどうか疑問に思います。
SPSite site;
SPWeb web;
SPServiceContext serviceContext;
UserProfileManager profiles;
UserProfile profile;
try
{
using (site = new SPSite(SPContext.Current.Web.Url))
{
using (web = site.OpenWeb())
{
serviceContext = SPServiceContext.GetContext(site);
profiles = new UserProfileManager(serviceContext);
//Getting the profile of logged in user.
profile = profiles.GetUserProfile(web.CurrentUser.LoginName);
//Getting profile of the manager of the logged in user.
profile = profile.GetManager();
}
}
}
catch { }
. 解決
実際には、マネージャ、ピア、および直接レポートの手法があります。
// Check whether the user profile and the manager user profile exist, and that they are not
// the same user.
if (userProfileManager.UserExists(loginName))
{
// Retrieve the user profile.
UserProfile userProfile = userProfileManager.GetUserProfile(loginName);
// Get the user's multiple levels of managers, peers, and direct reports.
managers = new List<UserProfile>(userProfile.GetManagers());
peers = new List<UserProfile>(userProfile.GetPeers());
directReports = new List<UserProfile>(userProfile.GetDirectReports());
.
}
2007年の作品は、2010年に同じでなければなりません:
所属していません sharepoint.stackexchange