.NET SDK Box.V2.Core v3.25 GetFolderItemsAsync not accepting sort date as parameter
I am trying to get the latest files uploaded in a folder. I am using the GetFolderItemsAsync function to get a list of files and folder sorted by date. I am able to get the contents but I cannot pass the sort parameter by date.
when I use the below, I get the error Newtonsoft.Json.JsonSerializationException: 'Error converting value "date" to type 'Box.V2.Models.BoxSortBy'. Path 'order.by', line 1, position 246.' and the BoxSortBy does not have a date equivalent.
var items = await appUserClient.FoldersManager.GetFolderItemsAsync(FolderId, 500,0, responeParam, false,"date", BoxSortDirection.DESC);
Note using the postman api collection I was able to sort the contents of a folder by date.
can you advise ?
Thank you for your response, I do not think its expecting a list, see the definition below;
public Task<BoxCollection<BoxItem>> GetFolderItemsAsync(string id, int limit, int offset = 0, IEnumerable<string> fields = null, bool autoPaginate = false, string sort = null, BoxSortDirection? direction = null);
further investigating the below work with sorting by Name but the BoxSortBy does not contain a date option the closest I found is BoxSortBy.interacted_at but this option throw a bad request error
var items = await appUserClient.FoldersManager.GetFolderItemsAsync(FolderId, 500,0, responeParam, false, BoxSortBy.Name.ToString(), BoxSortDirection.DESC);
Please sign in to leave a comment.