Office365-REST-Python-Client
Office365-REST-Python-Client copied to clipboard
Microsoft.SharePoint.SPQueryThrottledException
While testing https://github.com/vgrem/Office365-REST-Python-Client/blob/master/examples/sharepoint/lists/read_large.py I get the above error. Is there any mechanism currently to bypass this?
Complete error message:
office365.runtime.client_request_exception.ClientRequestException: ('-2147024749, Microsoft.SharePoint.SPQueryThrottledException', 'The query cannot be completed because the number of lookup columns it contains exceeds the lookup column threshold.', "500 Server Error: Internal Server Error for url:
@vgrem @mwarqee What size list is considered large ?
I use the blow code to get list items, will this not work for large lists ?
doc_lib = current_web.default_document_library()
items = (
doc_lib.items.select(["FileSystemObjectType"])
.expand(["File", "Folder"]) #office365/sharepoint/files/system_object_type.py
.get_all()
.execute_query_retry()
)
for idx, item in enumerate(items): # type: int, ListItem
if item.file_system_object_type == FileSystemObjectType.Folder:
print(
"({0} of {1}) Folder: {2} TimeLastModified: {3}".format(
idx, len(items), item.folder.serverRelativeUrl, item.folder.properties['TimeLastModified']
)
)
else:
print(
"({0} of {1}) File: {2} TimeLastModified: {3} Size: {4}".format(
idx, len(items), item.file.serverRelativeUrl, item.file.properties['TimeLastModified'], item.file.properties['Length']
)
)
print(item.file.properties)