get users by group in sharepoint

前端 未结 4 665
猫巷女王i
猫巷女王i 2021-02-08 12:15

can anyone show me how to get the users within a certain group using sharepoint?

so i have a list that contains users and or groups. i want to retrieve all users in that

4条回答
  •  北荒
    北荒 (楼主)
    2021-02-08 12:52

    note: an SPUser object can also be an AD Group (that is to say, an SPUser object might exist for "DOMAIN\Domain Users"... which is why the SPUser object also contains the property IsDomainGroup.

    From this information you can start to traverse through AD groups using the SPPrincipalInfo objects... however it's not always pleasant.

    One thing worth keeping in mind is that the SPGroup object includes the ContainsCurrentUser property which can traverse AD groups... this assumes you've got an SPGroup object to work from, however.

    Enjoy.
    -Scott

提交回复
热议问题