userProfileManager를 사용하여 특정 사용자에게보고하는 모든 사용자 목록을 어떻게 얻을 수 있습니까?
-
09-12-2019 - |
문제
userProfileManager 클래스는 사용자 프로파일에서 관리자를 당기는 메서드 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 년에 동일해야합니다 : http://msdn.microsoft.com/en-us/library/cc973103 (v= Office.12) .aspx
제휴하지 않습니다 sharepoint.stackexchange