0

I'm able to get the value of the file:

url = sharepoint_app_url + "_api/web/GetFileByServerRelativeUrl('" + file_path + "')/$value"

However when I want to get the versions or a specific version I get the 403 forbidden

url1 = sharepoint_app_url + "_api/web/GetFileByServerRelativeUrl('" + file_path + "')/Versions"

2
  • What permissions you have on the file, read/edit/full control? Dec 5, 2023 at 7:31
  • I have read write permissions Dec 5, 2023 at 9:38

1 Answer 1

0

Does your permission level has the checkbox "View versions"

enabled?/_layouts/15/editrole.aspx?role=Edit

enter image description here

19
  • Where do I find that ? Dec 6, 2023 at 20:25
  • https://[yoursitecollection]/_layouts/15/editrole.aspx?role=Edit Where role= your permission level (Read, Contribute, Full Control, etc) You can also go to https://[yoursitecollection]/_layouts/15/user.aspx And use the button permission levels in the Ribbon
    – Danny
    Dec 6, 2023 at 20:30
  • How are you setting up your connection to SharePoint? If you are using clientid/secret (ACS) then permissions have to be set using the appinv.aspx file
    – Danny
    Dec 6, 2023 at 20:38
  • yes permission have been added in appinv.aspx, <AppPermissionRequests AllowAppOnlyPolicy="true"> <AppPermissionRequest Scope="sharepoint/content/sitecollection" Right="Read" /> <AppPermissionRequest Scope="sharepoint/content/sitecollection/web/list" Right="Write"/> <AppPermissionRequest Scope="sharepoint/content/sitecollection/web/list" Right="FullControl"/> </AppPermissionRequests> Dec 6, 2023 at 20:41
  • What happens when you go in the browser to the versions: https://[yoursitecollection]/_api/web/lists/GetByTitle('Test')/Items(2)/Versions Replace listname and id with your values
    – Danny
    Dec 6, 2023 at 20:52

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.