onedrive api returned “The property SMTotalFileStreamSize is not supported for OrderBy”

彦青 段 0 Reputation points
2024-12-25T03:35:33.6133333+00:00

https://graph.microsoft.com/v1.0/me/drive/root/children?select=id,name,size,webUrl,createdDateTime,lastModifiedDateTime,folder,parentReference&$top=1000&$orderby=size%20desc

Hi,你好,我们调用以上这个接口根据size(orderby=size)排序时,会报以下错误:

{"error":{"code":"notSupported","message":"The property SMTotalFileStreamSize is not supported for OrderBy.","innerError":{"date":"2024-12-25T02:18:45","request-id":"32382729-ed54-4879-ae44-899e59d0a87b","client-request-id":"32382729-ed54-4879-ae44-899e59d0a87b"}}}

我们实际测试的现象是:

onedrive 非会员账号会报这个错误,onedrive 会员账号则不会报这个错误

想请问下这个问题是什么原因,以及我们该怎么解决?

Microsoft 365
Microsoft 365
Formerly Office 365, is a line of subscription services offered by Microsoft which adds to and includes the Microsoft Office product line.
5,375 questions
Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
10,569 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,663 questions
OneDrive
OneDrive
A Microsoft file hosting and synchronization service.
1,226 questions
OneDrive Management
OneDrive Management
OneDrive: A Microsoft file hosting and synchronization service.Management: The act or process of organizing, handling, directing or controlling something.
1,305 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 43,956 Reputation points
    2024-12-25T07:16:19.4066667+00:00

    Hi @彦青 段

    Try adding Prefer: HonorNonIndexedQueriesWarningMayFailRandomly to the request headers.

    GET /me/drive/root/children?select=id,name,size,webUrl,createdDateTime,lastModifiedDateTime,folder,parentReference&$top=1000&$orderby=size%20desc
    
    Prefer: HonorNonIndexedQueriesWarningMayFailRandomly
    

    User's image

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.