I have implemented a site and have added a SharePoint group called "SG_Uploader
".
In this group, I ONLY
have one Active Directory group called "AD_L6
" and there are many users in AD_L6.
If a user comes to site and I want to check if he can upload a document, I use below code which is very simple:
SPWeb web = // ...
SPGroup group = web.SiteGroups["SG_Uploader"];
if (group.ContainsCurrentUser)
{
// allow user to upload
}
Now, I want to do the same thing, not for current user but for a specific user that I have his username. By that mean I want to write a code like
SPWeb web = // ...
SPGroup group = web.SiteGroups["SG_Uploader"];
if (group.ContainsUser(username))
{
// allow user to upload
}
I could not figure out who I can do that. Please advise.