【问题标题】:Create folder using CMIS and Sharepoint使用 CMIS 和 Sharepoint 创建文件夹
【发布时间】:2015-06-17 13:46:30
【问题描述】:

目前我需要使用 CMIS 实现在 Sharepoint 存储库上创建一个文件夹,因此我使用它在路径 http://(server)/_vti_bin/cmis/soap 上提供的 Web 服务。我基于此示例实现了代码https://chemistry.apache.org/java/opencmis-cookbook.html,但 Sharepoint 不返回 rootFolderId,因此 getChildren 方法不返回任何内容。最后基于使用发现服务的查询,我检索了根文件夹 ID,但现在的问题是我无法创建子文件夹。这是我的代码:

            Object.cmisPropertyId p1 = new Object.cmisPropertyId();
            p1.propertyDefinitionId = "cmis:baseTypeId";
            p1.value = new string[1];
            p1.value[0] = "cmis:folder";
            propertiesType.Items.SetValue(p1, 0);

            Object.cmisPropertyString p2 = new Object.cmisPropertyString();
            p2.propertyDefinitionId = "cmis:name";
            p2.value = new string[1];
            p2.value[0] = "mytest";
            propertiesType.Items.SetValue(p2, 1);

            Object.cmisPropertyString p3 = new Object.cmisPropertyString();
            p3.propertyDefinitionId = "cmis:path";
            p3.value = new string[1];
            p3.value[0] = "Rep/f1/mytest";
            propertiesType.Items.SetValue(p3, 2);

            Object.cmisPropertyId p4 = new Object.cmisPropertyId();
            p4.propertyDefinitionId = "cmis:objectTypeId";
            p4.value = new string[1];
            p4.value[0] = "cmis:folder";
            propertiesType.Items.SetValue(p4, 3);

            Object.cmisPropertyId p5 = new Object.cmisPropertyId();
            p5.propertyDefinitionId = "cmis:parentId";
            p5.value = new string[1];
            p5.value[0] = "268";
            propertiesType.Items.SetValue(p5, 4);

            Object.cmisPropertyString p6 = new Object.cmisPropertyString();
            p6.propertyDefinitionId = "Author";
            p6.value = new string[1];
            p6.value[0] = "theAuthor";
            propertiesType.Items.SetValue(p6, 5);

            Object.cmisPropertyId p7 = new Object.cmisPropertyId();
            p7.propertyDefinitionId = "cmis:allowedChildObjectTypeIds";
            p7.value = new string[3];
            p7.value[0] = "cmis:document";
            p7.value[1] = "0x010100C98D402E3C78834C873469CE4F41E2C300B0A3B5E8A3E51543977DFDCE95850082";
            p7.value[2] = "cmis:folder";
            propertiesType.Items.SetValue(p7, 6);

var result = objectService.createFolder(repositoryInfo.repositoryId, propertiesType, null, null, null, null, ref extType);

它总是返回 null,我不确定如何正确地将参数传递给服务以使创建工作。我不知道在哪里可以找到告诉我我做错了什么的日志。

谢谢

PD:我需要使用这种方法,因为它是对已经使用 Sharepoint CMIS 服务的现有代码的修改。

【问题讨论】:

    标签: c# web-services sharepoint sharepoint-2013 cmis


    【解决方案1】:

    您尝试更新只读属性。见CMIS 1.0 http://docs.oasis-open.org/cmis/CMIS/v1.1/CMIS-v1.1.html Java 示例

    Folder root = session.getRootFolder();
    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
    properties.put(PropertyIds.NAME, "a new folder");
    Folder newFolder = root.createFolder(properties); 
    

    关键是“会话”。您应该创建与 CMIS 存储库(Atom 或 WSDL 绑定)的会话。会话将为您提供创建/检索文件夹/文档的能力

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-04
      • 2019-04-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多