kikovalle / PLGSharepointRestAPI-java

Easy to use wrapper for the Sharepoint Rest API v1. Even if this is not a full implementation it covers most common use cases and provides examples to extending this API.
MIT License
39 stars 31 forks source link

403 Forbidden: Before opening files in this location, you must first browse the website and select the option to login automatically #56

Open khatharsis42 opened 2 years ago

khatharsis42 commented 2 years ago

First of all, love this project, it might save my currrent internship, really, thanks a lot for doing this. Secondly: I'm having no problem fetching lists or info about a file or whatnot, but whe I try to download a file, I always get the same error: 403 Forbidden: "{"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"}}}", and when Itried to read the logs, I saw this: 1583 [main] DEBUG org.apache.http.headers - http-outgoing-1 << X-MSDAVEXT_Error: 917656; Access+denied.+Before+opening+files+in+this+location%2c+you+must+first+browse+to+the+web+site+and+select+the+option+to+login+automatically. I tried searching for something like that on the internet, but all I could find was advices on using IE or somehow manipulating your registry. Would you know how to fix this ?

My code:

String folder = "/sites/{site_name}/{path to folder}";
String fileName = "myFile.aspx";
wrapper.getFileInfo(folder + "/" + fileName);
wrapper.downloadFile(folder + "/" + fileName); // Error there
waldimiro commented 8 months ago

Same problem here... I can download but not updateFileMetadata(...) :(