public static async Task <FileFolderInfo> GetFileInfo(UserTokenHandler tokenHandler, string fileID) { var client = GetNewBoxClient(tokenHandler); Box.V2.Models.BoxFile file = await client.FilesManager.GetInformationAsync(fileID, new List <string> { BoxItem.FieldName, BoxItem.FieldModifiedAt, BoxItem.FieldParent }).ConfigureAwait(false); return(new FileFolderInfo { ID = file.Id, Name = file.Name, ParentFolderID = file.Parent == null ? "0" : file.Parent.Id, ModifiedAt = file.ModifiedAt }); }
public static async Task <FileFolderInfo> UploadFile(UserTokenHandler tokenHandler, string parentFolderID, string fileName, byte[] data) { var client = GetNewBoxClient(tokenHandler); var fileRequest = new Box.V2.Models.BoxFileRequest { Name = fileName, Parent = new BoxRequestEntity { Id = parentFolderID } }; Box.V2.Models.BoxFile file = await client.FilesManager.UploadAsync(fileRequest, new MemoryStream(data)).ConfigureAwait(false); return(new FileFolderInfo { ID = file.Id, Name = file.Name, ParentFolderID = parentFolderID }); }