Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am uploading doucment using object model. However my 'UploadFile()' method throws exception "The request failed with HTTP status 403: Forbidden.". This happens if my current user is not a member of one custom group (ABCGroup). And 'ABCGroup' has all permissions. Even if I give 'Full Control' permissions to this user it doesn't work. So I am really wondering.

share|improve this question
    
It's happening when they are part of ABCGroup or are not part of ABCGroup? It would be helpful to post a bit more code - there are some API calls that require high permissions. –  lgaud Oct 22 '12 at 1:24
add comment

1 Answer

As you are trying to upload files through code, did you try to use the RunWithElevatedPrivileges method ? Below is a link which will give you more information on the method.

http://msdn.microsoft.com/en-us/library/bb466220(office.12).aspx

You can do something like this:

SPSite siteColl = SPContext.Current.Site;
SPWeb site = SPContext.Current.Web;
SPSecurity.RunWithElevatedPrivileges(delegate() {
using (SPSite ElevatedsiteColl = new SPSite(siteColl.ID)) {
 using (SPWeb ElevatedSite = ElevatedsiteColl.OpenWeb(site.ID)) {

    ////Add your code to upload the file  here....

 }
}
});
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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