2011-04-27 2 views
2

SharePoint에서 사이트에 대한 액세스 권한이 부여 된 모든 사용자를 확인하고 싶습니다.SharePoint에서 "nt authority/authenticated users"그룹과 연결된 현재 사용자 목록을 프로그래밍 방식으로 가져올 수 있습니까?

사용자에게 직접 사용 권한이 부여되거나 SharePoint 그룹을 통해 사용 권한이 부여되거나 도메인 그룹을 통해 사용 권한이 부여 된 경우 필요한 정보를 얻을 수 있습니다.

그러나 사용자에게 "인증 된 사용자"그룹을 통한 권한이 부여 된 경우 해당 그룹과 연결된 사용자 목록을 찾는 방법을 모르겠습니다.

이것이 가능합니까?

답변

2

이것은 .Net 질문보다는 Sharepoint 질문입니다. 예. 이렇게 할 수 있습니다. AD API를 사용하여 도메인 컨트롤러에 모든 사용자 목록을 쿼리하십시오. 당신은 사용자 있습니다 AD의 모든 개체에 대한 쿼리를 수행하려고 할 수

http://www.codeproject.com/KB/system/everythingInAD.aspx

: 다음은 프로그램 AD 액세스를 시작하는 몇 가지 코드입니다.

Sharepoint 콘텐츠에 액세스 할 수있는 AD 외부 사용자는 표시되지 않습니다. 또한 도메인이 여러 개인 경우 Sharepoint 서버에 액세스 할 수있는 모든 AD 도메인을 쿼리해야합니다.

0

카일, 응답 해 주셔서 감사합니다. 이 정보를 사용하여

, 나는 모든 도메인의 모든 사용자를 얻기 위해 다음과 같은 내놓았다 :

private List<Principal> GetAllAuthenticatedUsers() 
{ 
    List<Principal> users = new List<string>(); 
    foreach (string domain in GetAllDomains()) 
    { 
     try 
     { 
      PrincipalContext context = new PrincipalContext(ContextType.Domain, domain); 

      // Create search condition for all enabled users 
      PrincipalSearcher searcher = new PrincipalSearcher(); 
      UserPrincipal user = new UserPrincipal(context); 
      user.Enabled = true; 
      user.Name = "*"; 
      searcher.QueryFilter = user; 

      // Get the users 
      System.DirectoryServices.AccountManagement.PrincipalSearchResult<Principal> results = searcher.FindAll(); 
      foreach (Principal principal in results) 
      { 
       users.Add(principal); 
      } 
     } 
     catch 
     { 
     } 
    } 

    return users; 

} 

private static List<string> GetAllDomains() 
{ 
    List<string> domains = new List<string>(); 
    using (Forest forest = Forest.GetCurrentForest()) 
    { 
     foreach (Domain domain in forest.Domains) 
     { 
      domains.Add(domain.Name); 
     } 
    } 

    return domains; 
} 
+0

그 그룹이 유효한 자격 증명이있는 사람을 의미한다. Active Directory를 인증/권한 부여 원본으로 사용하는 SP 환경에서 작업하는 경우 문자 그대로 디렉터리에있는 만료되지 않은 계정을 의미합니다. –

관련 문제