0

I want to add tag to a folder which shall be uploaded into box. Below one does not seem to work. I have enabled tags for my account in box from web UI

final BoxFolder uploadFolder = new BoxFolder(this.boxAPIConnection, parentFolderId); uploadFolder.getInfo().setTags(Arrays.asList("myTag"));

Looking at the code in com.box.sdk.BoxFolder#uploadFile(com.box.sdk.FileUploadParams) does not seem to consider the tag at all. Any help is very much appreciated

Ravisha
  • 3,261
  • 9
  • 39
  • 66

1 Answers1

0
        final BoxFolder folder = new BoxFolder(this.boxAPIConnection, folderId);
        final BoxFolder.Info folderInfo = folder.getInfo();
        folderInfo.setTags(Arrays.asList(tag));
        folder.updateInfo(folderInfo);

Apparently another. API call. If someone has better solution, please do suggest

Ravisha
  • 3,261
  • 9
  • 39
  • 66
  • 1
    This is the best way and is exactly as documented here: https://developer.box.com/guides/folders/single/update/ – PJSimon Mar 17 '20 at 05:38
  • Shouldn't we have an option to set the tags during folder creation.Why do you say this is the best way – Ravisha Mar 18 '20 at 08:54
  • Unfortunately, the folder has to be created before tags can be added to it; the two steps can't be combined into one operation. – PJSimon Apr 14 '20 at 19:37