We are building an Integration in the box cloud:
1. Application Type: Custom App
2. Authentication Type: OAuth 2.0
3. Context Menu items are added using “Web Integration”
The Web Integration (Context Menu) Configuration is:
- Supports all file extensions
- Integration Type is “Files”
We are using BOX-NODE-SDK
, to get the file details from the received fileId
.
On click of the web-integration, we received the authCode
and fileId
in the API.,
Using the AuthCode
, we successfully fetched the AccessToken
.
const sdk = new BoxSDK({
clientID: BOX_INTEGRATION_CLIENT_ID,
clientSecret: BOX_INTEGRATION_CLIENT_SECRET,
});
sdk.getTokensAuthorizationCodeGrant(authCode, null, function (err, tokenInfo) {
const boxClient = sdk.getPersistentClient(tokenInfo);
boxClient.files.get(fileId).then((file: any) => {
logger.info(file);
})
}
The above code sample returns the file details, but the path-collection is missing in the response.
Under the path-collection object, the entries
array is empty and total_count
is 0.
{
etag: "1"
extension: "txt"
file_version: {
id: "***"
sha1: "***"
type: "file_version"
}
id: "***"
lock: null
name: "sample.txt"
path_collection: {
entries: n],
total_count: 0
}
size: 7
type: "file"
version_number: "2"
}
But, as per the below image - the file is nested under multiple folders.
Any Idea what I am missing here?