ShareFile-NET
ShareFile-NET copied to clipboard
Navigate to File or Folder given Path
How would one go about obtaining the ShareFile.Api.Models.File or the ShareFile.Api.Models.Folder given a path?
E.g., the path can be:
- "My Files & Folders/Sample Folder/Sample Sub Folder"
- "My Files & Folders/Sample Folder/Sample Sub Folder/default.file"
- "Shared Folders/Sample Shared Folder/Sample Shared Sub Folder"
- "Shared Folders/Sample Shared Folder/Sample Shared Sub Folder/defaultShared.file"
For now, personally I'm using:
var folder = (ShareFileFolder)await sfClient.Items.Get().Expand("Children").ExecuteAsync();
to get the default folder, or:
var allSharedAlias = sfClient.Items.GetAlias("allshared");
var sharedFolder = await sfClient.Items.Get(allSharedAlias).Expand("Children").ExecuteAsync();
var folder = (ShareFileFolder)await sfClient.Items.Get(sharedFolder.url).Expand("Children").ExecuteAsync();
to get the shared folder. And from there, I'm recursively navigating from one path element to another, until the desired leaf.
Is there another simpler/faster way that's supported by the SDK?