GroupPrincipal method FindByIdentity throw strange exception

前端 未结 2 1938
离开以前
离开以前 2021-01-14 07:28

I am trying to get all users by group name and dispalay it in sharepoint webpart. adGroupName something like = \"CompanyGroup\".

GroupPrincipal grp = GroupPr         


        
2条回答
  •  借酒劲吻你
    2021-01-14 08:19

    Answer was found in blog:

    http://sharepoint-tweaking.blogspot.com/2007/12/impersonation-in-aspnet-causes.html

    Solution is to use code:

    using (HostingEnvironment.Impersonate()) {
         // This code runs as the application pool user
         DirectorySearcher searcher ...
    }
    

提交回复
热议问题