简体   繁体   中英

Sharepoint/Skydrive Pro API cannot add a folder to user's skydrive pro account

I am following this msdn article almost exactly but I cannot upload a file using csom:

http://msdn.microsoft.com/en-us/library/jj687470.aspx

I am using the following permissions:

"Web.Manage"

Here is where my code is failing

private void InitializeClientContext(ClientContext context)
        {
            context.Load(context.Web);
            context.ExecuteQuery();  //works fine
            context.Load(context.Web.Folders);
            context.ExecuteQuery();  //works fine
            context.Web.Folders.Add(SkyDriveDocusignFolderUrl);
            context.ExecuteQuery();  // fails
        }

I am able to load the web and the folders of the user but when I go to create a documents folder: [https://sharepointurl]/personal/joe_cartano_docusign_com/documents/docusign

on the last line of this code I get the following:

“Access denied. You do not have permission to perform this action or access this resource.”

Perhaps I need another permission? It isn't clear what is needed since the walkthrough just loads the Web and reads a property from it. I need to add a folder and a file to that folder. What is the proper set of permissions to do this or is there some other issue I am missing? I was able to execute this exact code using claims auth so I think it is generally correct.

The answer to this turned out to be that the URL the client context was initialized with was wrong but was still able to load the web context. It was pointing to the root of my sharepoint site rather than to the folder one level above my Documents folder. As soon as I changed the path everything started working.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM