2

I'm able to add a .txt file to my Sharepoint library by posting to this URL:

https://my_subdomain.sharepoint.com/sites/my_path/_api/web/GetFolderByServerRelativeUrl('/sites/my_path/Pages')/Files/add(url='my_text_file.txt',overwrite=true)

...but when my_text_file.txt is replaced with my_page.aspx, the server responds with the error:

"error": { "code": "-2147024891, System.UnauthorizedAccessException", "message": { "lang": "en-US", "value": "Access denied. You do not have permission to perform this action or access this resource." } }

I believe I have all of the permissions a user can have, so I ask:

  1. Is what I'm trying to do even possible?
  2. Should I believe the error message - is this really a permissions issue?
  3. Is there a way for me to determine what permissions I have via REST?

Thank you!

SharePoint docs page: https://msdn.microsoft.com/en-us/library/office/dn292553.aspx

  • Thinking out loud: Could it be the Publishing Feature taking control once an aspx file is created. What happens on a non-publishing (Team) site? Can you rename your .txt file to other extensions? – Danny '365CSI' Engelman Aug 31 '16 at 18:41
  • I can rename as and upload other file types (.docx, .pdf...). And yes, I've tried disabling publishing but I get the same result. – Gregor Sep 2 '16 at 15:03
  • You wouldn't have happened to figure this out, would you? – Casey May 25 '17 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.