을 얻으려고 사용자의 관리자:을 받고 SPServiceContext 와 SiteSubscriptionId 의{00000000-0000-0000-0000-000000000000}

sharepoint.stackexchange https://sharepoint.stackexchange.com//questions/53065

문제

을 얻기 위해 노력하고있어 사용자의 관리자와 이 코드:

SPSecurity.RunWithElevatedPriviliges(delegate
{
  SPSite site = new SPSite(SPContext.Current.Site.Url);
  SPServiceContext context = SPServiceContext.GetContext(site);
  UserProfileManager profileManager = new UserProfileManager(context);
  //Note that I have an SPUser object, user, previously defined.
  UserProfile userProfile = profileManager.GetUserProfile(user.ID);
  UserProfile managerProfile = userProfile.GetManager();
});

내 문제는 나를 받고 null UserProfileManager.나는 그것을 의심하기 때문에 SPServiceContext 는 SiteSubcriptionId 의{00000000-0000-0000-0000-000000000000}.

나는 디버깅이에서 SharePoint server.나는 그것을 실행하는 개발 환경에서 윈도우 7.이러 문제가 있음을 나타내 환경 내?

더 좋은 방법이 있을 얻을 수의 관리자는 주어진 웹 사이트?

편집:

그것은 나도 내 또는 로컬 컴퓨터 내 테스트 서버는 사용자 프로필 서비스를 올바르게 설정되어.그래서 그는 이유는 아마도 그것은 작동하지 않습니다.내가 하려는 작업하면 내가 여전히 문제입니다.

도움이 되었습니까?

해결책

빈 Guid 여기에 실제로에 관한 하지 않습니다.이 SiteSubscriptionId 것 빈 Guid 있지 않으면 multi-tenancy 사용 환경에서입니다.

도록 다자 지원 SharePoint2010

를 추가해야 할 수도 있습에 대한 권한은 귀하의 사용자가 사용자 프로필 서비스 응용 프로그램입니다.

구성 사용자 프로필 동기 연결 들을 얻으려고 노력 UserProfileManager 을 통해 PowerShell 및 오류(NullReferenceException 다)하지만 그것을 해결함으로써 사용자 계정을 얻으려고 시도하 UserProfileManager 권한:

1)으로 관리자와 함께 전체 제어

2)연결 사용 권한으로 전체 제어

다음 액세스할 수 있는 사용자가 선택할 수 있도록 하려면 및 수 있는 프로그래밍 방식으로스 연결이 있습니다.

다른 팁

관리자와 UPSA의 권한 외에도 SharePoint 설치 프로그램을 ProfileDB에 db_owner로 추가해야했습니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top