Python MSAL REST Graph:是否可以在一个请求中获取文件夹中的所有文件,而不仅仅是 200 个文件?
Python MSAL REST Graph: is it possible to get all files in folder, not just 200, in one request?
我需要从 OneDrive 文件夹中删除所有文件。当我发出类似 # Listing children(all files and folders) within General
here, I only get 200 items, which seems to be the expected default behavior per this 下显示的请求时。于是为了删除所有文件,我多次重复请求,每次删除200个文件。是否可以在一个请求中获取所有子项?
这有效:
link = parent+":/children"
while True:
rGetCh = requests.get(link, headers=headers)
for ch in rGetCh.json()["value"]:
# Looping through the current list of children
chName = urllib.parse.quote(ch["name"].encode('utf8'))
chPath = parent + "/" + chName
if "@odata.nextLink" in rGetCh.json(): # if this is in the response, there are more children
link = rGetCh.json()["@odata.nextLink"]
else:
break
我需要从 OneDrive 文件夹中删除所有文件。当我发出类似 # Listing children(all files and folders) within General
here, I only get 200 items, which seems to be the expected default behavior per this 下显示的请求时。于是为了删除所有文件,我多次重复请求,每次删除200个文件。是否可以在一个请求中获取所有子项?
这有效:
link = parent+":/children"
while True:
rGetCh = requests.get(link, headers=headers)
for ch in rGetCh.json()["value"]:
# Looping through the current list of children
chName = urllib.parse.quote(ch["name"].encode('utf8'))
chPath = parent + "/" + chName
if "@odata.nextLink" in rGetCh.json(): # if this is in the response, there are more children
link = rGetCh.json()["@odata.nextLink"]
else:
break