weblinks
AnsweredHow to retrieve weblinks from root folder with box java sdk?
-
hi Ritika
You can use the BoxItem.Info.getType() to work out the type of items in the folder. Either File,Folder or Weblink
https://github.com/box/box-java-sdk/blob/main/doc/folders.md#get-a-folders-itemsFor root folder you could do something like this:
BoxFolder folder = new BoxFolder(api, "0"); for (BoxItem.Info itemInfo : folder) {
if (itemInfo.getType().equals("web_link") {
BoxWeblink.Info weblinkInfo = (BoxWeblink.Info) itemInfo;
// Do something with the weblink.
} else if (itemInfo.getType().equals("file") { BoxFile.Info fileInfo = (BoxFile.Info) itemInfo; // Do something with the file. } else if (itemInfo.getType().equals("folder") { BoxFolder.Info folderInfo = (BoxFolder.Info) itemInfo; // Do something with the folder. } }Best regards
Peter Christensen, Platform Solutions Engineer, Box -
Thanks Peter Christensen
Please sign in to leave a comment.
Comments
2 comments