0
我使用Microsoft OneDrive Python SDK爲了在OneDrive
中執行一些操作,例如上傳/刪除/重命名文件,創建新文件夾...... 但是,我花了相當多的時間試圖按順序讀取SDK瞭解如何共享文件或文件夾,以及更改/刪除/更新此類文件或文件夾的權限。如何使用Microsoft OneDrive Python SDK共享文件?
self.client = onedrivesdk.get_default_client(client_id=client_id,
scopes=['wl.signin',
'wl.offline_access',
'onedrive.readwrite',
'onedrive.appfolder'])
def copy_item(self, parent_id, item_id, name):
"""
Make a copy of an existing file
Args:
parent_id: (string)
the file's folder id
item_id: (string)
the file id
name: (string)
the new name the file
"""
assert self.client is not None
try:
ref = ItemReference()
ref.id = parent_id
copy_operation = self.client.item(drive=self.drive, id=item_id).copy(
name=name, parent_reference=ref).post()
copy_operation.poll_until_complete()
except onedrivesdk.error.OneDriveError, error:
self.log.exception("An error occurred: {0}".format(error))
例如,望着share API,我能看到文件的共享,但我還是不知道如何才能使請求使用client
。文檔雖然不是很好。有人可以幫助我如何使用OneDrive Python SDK API分享/更新文件或文件夾中的權限?
Brad,甚至沒有共享鏈接?如果我要利用當前的API,我必須通過Python請求來完成它?你能否添加一個例子,我該如何做到這一點? – cybertextron
你可以創建鏈接(查看和編輯)[使用此](https://github.com/OneDrive/onedrive-sdk-python/tree/master/examples#get-a-sharing-link),但你贏了'能夠查看項目上存在的鏈接,刪除它們等,因爲這需要'權限' – Brad