Box representation of a folder
Наследование: Box.V2.Models.BoxItem
Пример #1
0
 private static Task<BoxFile> UploadFile(BoxFolder newFolder, BoxClient userClient, Stream file)
 {
     var fileRequest = new BoxFileRequest
     {
         Name = "logo.png",
         Parent = new BoxFolderRequest { Id = newFolder.Id }
     };
     return userClient.FilesManager.UploadAsync(fileRequest, file);
 }
        private static async Task <FileFolderInfo> CreateFolder(BoxClient client, UserTokenHandler tokenHandler, string name, string parentFolderID)
        {
            var folderRequest = new BoxFolderRequest {
                Name = name, Parent = new BoxRequestEntity {
                    Id = parentFolderID
                }
            };

            Box.V2.Models.BoxFolder folder = await client.FoldersManager.CreateAsync(folderRequest, new List <string> {
                BoxItem.FieldName, BoxItem.FieldModifiedAt
            }).ConfigureAwait(false);

            return(new FileFolderInfo(folder.Id, folder.Name, parentFolderID, folder.ModifiedAt));
        }
        public static async Task <FileFolderInfo> GetFolderInfo(UserTokenHandler tokenHandler, string folderID)
        {
            var client = GetNewBoxClient(tokenHandler);

            Box.V2.Models.BoxFolder folder = await client.FoldersManager.GetInformationAsync(folderID, new List <string> {
                BoxItem.FieldName, BoxItem.FieldModifiedAt, BoxItem.FieldParent
            }).ConfigureAwait(false);

            return(new FileFolderInfo
            {
                ID = folder.Id,
                Name = folder.Name,
                ParentFolderID = folder.Parent == null ? "0" : folder.Parent.Id,
                ModifiedAt = folder.ModifiedAt
            });
        }