I have a situation where I need to get all members of a group. I have successfully done this, but now there might be a scenario where another group might be member of the original group and hence I would also need to grab users of this child group.
During traversing, how can I check if the item is a user or a group?
You could check for samaccounttype. 805306368 should be for users. Just declare each entry in the memberof list as a diretoryentry and load that property to check it.
mavrick_101
Member
96 Points
64 Posts
Checking if an item retrieved is a user or group
May 07, 2012 08:01 PM|LINK
I have a situation where I need to get all members of a group. I have successfully done this, but now there might be a scenario where another group might be member of the original group and hence I would also need to grab users of this child group.
During traversing, how can I check if the item is a user or a group?
Thanks for your help!
kushal.dwive...
Member
396 Points
61 Posts
Re: Checking if an item retrieved is a user or group
May 08, 2012 08:22 AM|LINK
You can check either objectCategory or objectClass property of the object to see if it is group.
i.e. objectCategory='group'
gww
Contributor
2143 Points
458 Posts
Re: Checking if an item retrieved is a user or group
May 08, 2012 06:40 PM|LINK
You could check for samaccounttype. 805306368 should be for users. Just declare each entry in the memberof list as a diretoryentry and load that property to check it.
mavrick_101
Member
96 Points
64 Posts
Re: Checking if an item retrieved is a user or group
May 08, 2012 08:38 PM|LINK
Thanks.
ObjectClass, ObjectCategory would be the solution.