I've got a SharePoint list with a field where authorized users and/or groups are listed. I know I can use CanCurrentUserViewMembership to check if the user belongs to a specific group, but if the ID I pass belongs to a user I get an Internal Server Error.

Is there a way to check whether the ID belongs to a person or group before making this call? Taking into consideration that I'm doing this on a loop, so a lot of calls are being made.


You can make a separate call to a function get all group ID's in an array before calling your current function.

Inside your current function, check if the user/group ID is available in array - then its group else user.

Pseudo code

// Get all Group ID
var groupID[] = *array of IDS*

// Current Code 

     // Check if ID is in gorupID[]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.