如何通过.NET在BIM 360上创建文件夹

时间:2019-01-28 14:26:32

标签: .net post autodesk-forge create-directory

我当前正在尝试在Plans顶级文件夹中创建一个名为“ NET文件夹”的文件夹。使用我的方法,程序崩溃并显示以下输出:

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

下面的代码是我当前正在使用的代码:

CreateFolderDataRelationshipsParentData createFolderRelationshipsParentData = new CreateFolderDataRelationshipsParentData(
    "folders",
    parentFolderId);
CreateFolderDataRelationshipsParent createFolderDataRelationshipsParent = new CreateFolderDataRelationshipsParent(createFolderRelationshipsParentData);
CreateFolderDataRelationships createFolderDataFolderRelationships = new CreateFolderDataRelationships(createFolderDataRelationshipsParent);
BaseAttributesExtensionObjectWithoutSchemaLink baseAttribute = new BaseAttributesExtensionObjectWithoutSchemaLink(
    "folders:autodesk.bim360:Folder",
    "1.0",
    folderInfo.Value.attributes.extension.data);
CreateFolderDataAttributes createFolderDataAttributes = new CreateFolderDataAttributes("NET Folder", baseAttribute);
CreateFolderData createFolderData = new CreateFolderData(createFolderDataAttributes, createFolderDataFolderRelationships);
CreateFolder createFolder = new CreateFolder(new JsonApiVersionJsonapi(JsonApiVersionJsonapi.VersionEnum._0), createFolderData);

folderApi.PostFolder(projectId, createFolder);

创建一个名为“ NET Folder”的文件夹时是否缺少我的东西?

1 个答案:

答案 0 :(得分:0)

问题是我在BaseAttributesExtensionObjectWithoutSchemaLink内使用了错误的对象主体。我没有使用folderInfo.Value.attributes.extension.data,而是将其替换为folder.data,并且此后仍然有效。