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

moveFolder() fails HttpClientErrorException #51

Open martin-schmude opened 2 years ago

martin-schmude commented 2 years ago

Call of moveFolder() results in HttpClientErrorException.
The exception contains a detailMessage:
400 Bad Request: "{"error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"The parameter name flags is not valid."}}}"

I copied the moveFolder() method and modified it to leave the flags away. So the URL is not https://<company-site>/_api/web/GetFolderByServerRelativeUrl('/sites/<site>/<from>/')/moveto(newUrl='/sites/<site>/<to>/',flags=1) but instead https://<company-site>/_api/web/GetFolderByServerRelativeUrl('/sites/<site>/<from>/')/moveto(newUrl='/sites/<site>/<to>/') With this modification the exception did not occur anymore, and the folder was moved as expected.