-1

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.

0

Use DoesUserHavePermissions to check if user has permissions to upload.

web.DoesUserHavePermissions(web.CurrentUser,
                   SPBasePermissions.AddListItems);
  • Thanks for reply. I'm not sure how this is related to my question. Maybe you misunderstood my question or I don't get your point. It is not about upload. I mentioned upload just as an example. – FLICKER Jul 16 '18 at 3:17

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.