In C#, I want to create a folder in my SharePoint Online site without using SharePoint client object model.

I am trying to use SharePoint REST APIs and List methods.

I don't want to use Microsoft.SharePoint.Client as the use of this DLL requires SharePoint Client Components to be installed on the client server.

I have found the this useful link to achieve this. This works fine for SharePoint On-premise instance, but not for SharePoint Online.

It throws the following error message when run for SharePoint Online

Server was unable to process request. ---> Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

Is there any way to solve this problem?


1 Answer 1


Endpoint URI

http://<site url>/_api/web/folders (top-level folders at the root site)

http://<site url>/_api/web/getfolderbyserverrelativeurl('/<folder name>')/folders

Create a folder (POST request example)

  url: "<app web url>/_api/SP.AppContextSite(@target)/web
    /getfolderbyserverrelativeurl('/Shared Documents/Folder A')/folders
    ?@target='<host web url>'",
  method: "POST",
  body: "{ '__metadata':{ 'type': 'SP.Folder' }, 'ServerRelativeUrl':'Folder B' }",
  headers: {
    "accept": "application/json; odata=verbose",
    "content-type": "application/json; odata=verbose"
  success: successHandler,
  error: errorHandler

Please refer this link

  • Thank you. But, I am writing C# (plugin) code and not a JavaScript code. Mar 11, 2015 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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