简体   繁体   中英

How to deserialize results of Autodesk.Forge.FoldersAPI.GetFolderContentsAsync(...)

I am trying to list the file contents of a given BIM360 folder using the forge .NET client to access the Autodesk's Data Management API.

GetFolderContents returns a JsonApiCollection but I am confused as to how to deserialize the response data using the SDK's model objects.

C# sample code from the documentation:

// Configure OAuth2 access token for authorization: oauth2_access_code
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

var apiInstance = new FoldersApi();
var projectId = projectId_example;  // string | the `project id`
var folderId = folderId_example;  // string | the `folder id`
var filterType = new List<string>(); // List<string> | filter by the `type` of the `ref` target (optional)
var filterId = new List<string>(); // List<string> | filter by the `id` of the `ref` target (optional)
var filterExtensionType = new List<string>(); // List<string> | filter by the extension type (optional)
var pageNumber = 56;  // int? | specify the page number (optional)
var pageLimit = 56;  // int? | specify the maximal number of elements per page (optional)

try
{
    JsonApiCollection result = apiInstance.GetFolderContents(projectId, folderId, filterType, filterId, filterExtensionType, pageNumber, pageLimit);
    Debug.WriteLine(result);
}
catch (Exception e)
{
    Debug.Print("Exception when calling FoldersApi.GetFolderContents: " + e.Message );
}

Please refer to our Hubs Browser tutorial that handles this.

Specificaly in the Data Browsing part.

You can also check the repo .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM