python-o365 icon indicating copy to clipboard operation
python-o365 copied to clipboard

Copy and Move Operations Suddenly Not Working

Open raorourke opened this issue 3 years ago • 1 comments

I've been using this API for several years without issues. It's wonderful. However, I've noticed suddenly in the last few days that my copy and move operations are not working for the SharePoint API. When trying to copy something, it's confusing the target for the parent, yielding an error that there is already something there with the same name, even if specifying the target and name explicitly.

ERROR:O365.connection:Client Error: 400 Client Error: Bad Request for url: https://graph.microsoft.com/v1.0//sites/welocalize.sharepoint.com,aaffe077-92eb-4711-b616-bd407fd56f2f,0870ef06-4bc7-4227-a6d8-10df493070c3/drive/items/01R246IS7WCJL2Q4FGRRDIAIWQ6UMM2RIY/copy | Error Message: At least one of 'parentReference.id', 'parentReference.path', 'parentReference.sharepointIds' or 'name' must be provided for a copy operation. Traceback (most recent call last): File "/Users/welocalize/PycharmProjects/weautomate/.venv/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3441, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 10, in item.copy(target) File "/Users/welocalize/PycharmProjects/weautomate/.venv/lib/python3.8/site-packages/O365/drive.py", line 770, in copy response = self.con.post(url, data=data) File "/Users/welocalize/PycharmProjects/weautomate/.venv/lib/python3.8/site-packages/O365/connection.py", line 822, in post return self.oauth_request(url, 'post', data=data, **kwargs) File "/Users/welocalize/PycharmProjects/weautomate/.venv/lib/python3.8/site-packages/O365/connection.py", line 800, in oauth_request return self._internal_request(self.session, url, method, **kwargs) File "/Users/welocalize/PycharmProjects/weautomate/.venv/lib/python3.8/site-packages/O365/connection.py", line 762, in _internal_request raise HTTPError('{} | Error Message: {}'.format(e.args[0], error_message), response=response) from None requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://graph.microsoft.com/v1.0//sites/welocalize.sharepoint.com,aaffe077-92eb-4711-b616-bd407fd56f2f,0870ef06-4bc7-4227-a6d8-10df493070c3/drive/items/01R246IS7WCJL2Q4FGRRDIAIWQ6UMM2RIY/copy | Error Message: At least one of 'parentReference.id', 'parentReference.path', 'parentReference.sharepointIds' or 'name' must be provided for a copy operation.

When the move operation is called, it seems to work fine, returns True, but nothing is moved in the actual folder. I've been trying to debug this for a bit now and am having no luck.

raorourke avatar Apr 19 '22 13:04 raorourke

Seems odd as it used to work... Maybe some api change on the microsoft side. don't know and also I don't have the time to investigate this right now

alejcas avatar Apr 22 '22 09:04 alejcas