box / box-windows-sdk-v2

Windows SDK for v2 of the Box API. The SDK is built upon .NET Framework 4.5

Home Page:https://developer.box.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sorting FoldersManager.GetFolderItemsAsync results

pixelnix opened this issue · comments

  • I have checked that the [SDK documentation][sdk-docs] doesn't solve my issue.
  • I have checked that the [API documentation][api-docs] doesn't solve my issue.
  • I have searched the [Box Developer Forums][dev-forums] and my issue isn't already reported (or if it has been reported, I have attached a link to it, for reference).
  • I have searched [Issues in this repo][github-repo] and my issue isn't already reported.

Description of the Issue

The method contract for FoldersManager.GetFolderItemsAsync() contains a sort param and direction param. So I tried sorting by modified date descendingly:
await boxClient.FoldersManager.GetFolderItemsAsync(folderId, limit: 200, offset: 0, fields: ......, sort: "modified_at", direction: BoxSortDirection.DESC);
But this results in a Bad Request exception.

How do I use the sort param in a way that doesn't generate a bad request? What sorting capabilities does this part of the SDK actually have?

Hi @pixelnix

According to spec you can only sort by the following values:
Value is one of id,name,date,size
See: https://developer.box.com/reference/get-folders-id-items/#param-sort. That's probably why you get the BadRequest exception.

Ok so only date, not modified or created date. Thanks for clarifying.