Skip to content

Commit 96ba7a3

Browse files
authored
Merge pull request #61 from box/folder-description
Removed SyncState from CSV model for creating folders, enabled descri…
2 parents 76b0db5 + 411fdfc commit 96ba7a3

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

BoxCLI/CommandUtilities/CsvModels/BoxFolderCreateRequestMap.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ public BoxFolderCreateRequestMap()
1010
{
1111
Map(m => m.Name);
1212
Map(m => m.Description);
13-
Map(m => m.SyncState);
1413
References<BoxFolderRequestParentMap>(m => m.Parent);
1514
}
1615
}

BoxCLI/Commands/FolderSubCommands/FolderCreateCommand.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public class FolderCreateCommand : FolderSubCommandBase
1919
private CommandOption _fileFormat;
2020
private CommandOption _save;
2121
private CommandOption _idOnly;
22+
private CommandOption _description;
2223
private CommandLineApplication _app;
2324
private IBoxHome _home;
2425

@@ -40,6 +41,8 @@ public override void Configure(CommandLineApplication command)
4041
_parentFolderId = command.Argument("parentFolderId",
4142
"Id of parent folder to add new folder to, use '0' for the root folder");
4243
_name = command.Argument("name", "Name of new folder");
44+
_description = command.Option("--description",
45+
"A description for folder <DESCRIPTION>", CommandOptionType.SingleValue);
4346
command.OnExecute(async () =>
4447
{
4548
return await this.Execute();
@@ -73,6 +76,13 @@ await this.CreateFoldersFromFile(this._bulkPath.Value(), this._save.HasValue(),
7376
folderRequest.Parent.Id = this._parentFolderId.Value;
7477
folderRequest.Name = this._name.Value;
7578
var folder = await BoxClient.FoldersManager.CreateAsync(folderRequest);
79+
var update = new BoxFolderRequest();
80+
if (this._description.HasValue())
81+
{
82+
update.Description = this._description.Value();
83+
update.Id = folder.Id;
84+
folder = await BoxClient.FoldersManager.UpdateInformationAsync(update);
85+
}
7686
if (this._idOnly.HasValue())
7787
{
7888
Reporter.WriteInformation(folder.Id);

BoxCLI/Commands/FolderSubCommands/FolderSubCommandBase.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,13 @@ protected async virtual Task CreateFoldersFromFile(string path,
114114
try
115115
{
116116
createdFolder = await boxClient.FoldersManager.CreateAsync(folderRequest);
117+
var update = new BoxFolderRequest();
118+
if (!string.IsNullOrEmpty(folderRequest.Description))
119+
{
120+
update.Description = folderRequest.Description;
121+
update.Id = createdFolder.Id;
122+
createdFolder = await boxClient.FoldersManager.UpdateInformationAsync(update);
123+
}
117124
}
118125
catch (Exception e)
119126
{

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
- Fixed bug preventing removal of a user from an Enterprise and conversion to a free user account.
55
- Fixed bug that returned incorrect total count when using `box list users -m` to only list managed users.
66
- Added CreatedAt field to CSV output for events.
7+
- Removed SyncState from CSV for creating folders.
8+
- Enabled setting a description for a folder when creating the folder.
79

810
## 1.1.0
911
- Added new feature on all commands for using an individual token. Add the `--token` option to perform an individual command with the Box CLI using a specific token you provide. The feature is most useful when paired with the Developer Token you can generate through the Box Developer Console. When working with an application you create in the Box Developer Console, you will not need to authorize the application into a Box Enterprise before working with the Developer Token. For example usage: `box users get me --token <token_string>`. Certain commands may fail based on the permissions of the user to which the token you use belongs.

0 commit comments

Comments
 (0)