I have a code in which I have to check if a user is a part of a certain group (lets say "GroupA").
I have the user details stored in the Sharepoint variable SPUser. Now I need to check if this user is a part of GroupA and then take some action.
How can I achieve this?
Source : How to check if a user exists in a group
you can use following extension method, like this:
Then call it like this:
If you want to check the current user then another approach can be like this:
From: Check user already exist in specified SharePoint Group
For More Reference:
Tell if user exists in SharePoint Group through web service