Get oldest file information
I have a folder and need to keep only the latest 120 files because my app constantly upload new file.
The BoxItem 'CreatedAt' is empty/null and I need to use 'FilesManager.GetInformationAsync()' to query file information in order to get the 'CreatedAt' time stamp which is time consuming.
I would like to know if any better method to query all file information with 'CreatedAt' in a folder at once?
var boxItems = adminClient.FoldersManager.GetFolderItemsAsync("12212", 200);
foreach (BoxItem item in boxItems.Entries)
adminClient.FilesManager.GetInformationAsync(id: item.Id);
-
Hi ,
For that you can use the list items in a folder endpoint (this method in the .NET SDK). By default I don't believe you will get createdAt in the return object, so in the method request set "fields" to include "created_at".
I just tested this against the API directly, setting fields to "id,type,name,created_at", and am seeing all created at date information returned for all items in the folder I specified.
Please sign in to leave a comment.
Comments
1 comment