简体   繁体   English

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

[英]How to create a folder on BIM 360 though .NET

I am currently trying to create a folder inside the Plans Top Folder with the name "NET folder". 我目前正在尝试在Plans顶层文件夹中创建一个名称为“ NET文件夹”的文件夹。 Using my method, the program crashes with the output: 使用我的方法,程序崩溃并输出:

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

The code below is what I am currently using: 下面的代码是我当前正在使用的代码:

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);

Is there something I am missing to create a folder with the name "NET Folder"? 创建名称为“ NET文件夹”的文件夹时,我缺少什么吗?

The problem was I was using the wrong object body inside the BaseAttributesExtensionObjectWithoutSchemaLink . 问题是我在BaseAttributesExtensionObjectWithoutSchemaLink使用了错误的对象主体。 Instead of using folderInfo.Value.attributes.extension.data , I replaced it with folder.data and it worked after. 我没有使用folderInfo.Value.attributes.extension.data ,而是将它替换为folder.data ,并且此后可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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