Retrieving folder details
Am trying to retrieve the sub folders, files of a folder.
Current code I use is:
var items = await adminClient.FoldersManager.GetFolderItemsAsync("0", 10); // "0", 500 = root (original settings) "191933278438"
items.Entries.ForEach(i =>
{
MessageBox.Show("\t{0}", i.Name);
});
If I leave the line as "0", 10 the code moves to the next line items.Entries.... but the program says there are no items (though if I look in Box there are. If I set it to the actual folder number that I want to return the contents of "191933278438" the program I assume errors and doesn't go to the next line.
I have double checked the folder number, it is correct, what else do I need to check?
regards,
Matt
-
Hi Matthew,
The most common issue in these situations is that the app is using a service account that can not, by it self, access the content you want.
This would be consistent with the empty root folder.
So let me start by asking how is your box application configured, is it oAuth2 (User or Client Authentication), CCG (Client Credentials Grant Server Authentication), or JWT (JSON Web Tokens Server Authentication)?
If you have your app configured as CCG or JWT, have you submitted it for approval on the Authorization tab on the app configurations in the developer console?
For example I have a JWT configured app and it looks like this:
If you haven't done so you need to click review and submit and your administrator must approve it.
This is not needed for OAuth apps.
If your app is CCG or JWT it will be using a service account.
If that is the case, for the service account to access content:
- the content must be owned by the service account
- or the content has been explicitly shared with the service account
- or the service account is impersonating a user who can access the content(aka as-user)
Let me know the details, and we'll continue to explore this.
By the way, what stack are you using, node, python?
サインインしてコメントを残してください。
コメント
1件のコメント