we trying to upload the documents from box application to our project from a specific folder. In this folder users may update the existing files and we need to upload those files and I wanted to extract those file. In the documentation I’ve observed this API but I am not understanding what values do I need to use in the variables
- from
- and value to set in the field mQuery.setFields(“metadata.enterprise_341532.test.customField”)
Could you please tell me what values do I need to give in these fields.
String from = "enterprise_341532.test";
String query = "testfield = :arg";
String ancestorFolderId = "0";
MetadataQuery.OrderBy primaryOrderBy = MetadataQuery.OrderBy.ascending("primarySortKey");
MetadataQuery.OrderBy secondaryOrderBy = MetadataQuery.OrderBy.ascending("secondarySortKey");
MetadataQuery mQuery = new MetadataQuery(from);
mQuery.setQuery(query);
mQuery.setAncestorFolderId(ancestorFolderId);
mQuery.setOrderBy(primaryOrderBy, secondaryOrderBy);
mQuery.addParameter("arg", "test");
mQuery.setFields("metadata.enterprise_341532.test.customField");
BoxResourceIterable<BoxItem.Info> results = MetadataTemplate.executeMetadataQuery(api, mQuery);
for (BoxItem.Info r: results) {
if (r instanceof BoxFile.Info) {
BoxFile.Info fileInfo = (BoxFile.Info) r;
Metadata fileMetadata = fileInfo.getMetadata("test", "enterprise_341532");
String customFieldValue = fileMetadata.getString("/customField");
System.out.println(customFieldValue);
} else if (r instanceof BoxFolder.Info) {
BoxFolder.Info folderInfo = (BoxFolder.Info) r;
Metadata folderMetadata = folderInfo.getMetadata("test", "enterprise_341532");
String customFieldValue = folderMetadata.getString("/customField");
System.out.println(customFieldValue);
}
}
> Blockquote