【问题标题】:Setting/Updating multiple document properties in SharePoint 2010 using OpenCMIS使用 OpenCMIS 在 SharePoint 2010 中设置/更新多个文档属性
【发布时间】:2013-02-07 15:08:01
【问题描述】:

已尝试几乎“无处不在”搜索此功能,但找不到有关如何实现此功能的指针。请查看我的代码并提供有关如何使用 OpenCMIS 在 SharePoint 中设置/更新所有文档属性的建议。已使用 CMIS 成功创建了文档,但是我无法为不同的文档填充不同的值。

例如,a.pdf、b.pdf 有不同的属性。因此,当我更新它们时,我希望从分配给它们的值数组映射该值,但目前,相同的值被附加到所有文档...

请看下面我的代码,希望它能让事情更清楚:

            try {
                String [] nextLine =null;
                CSVReader reader = new CSVReader(new FileReader(indexFileLocation));
                List content = reader.readAll();

                for (Object o : content) {
                    nextLine = (String[]) o;
                    System.out.println("\n"+ nextLine[2] + "\n"+nextLine[7] + "\n"+ nextLine[6]);
                }
                //reader.close();
                Map <String, Object> newDocProps = new HashMap<String, Object>();
                newDocProps.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
                newDocProps.put(PropertyIds.NAME, ff.getName());
                Document doc = newFolder.createDocument(newDocProps, contentStream, VersioningState.NONE);

                CmisObject cmisobject = (Document) session.getObject(doc.getId());
                Map<String, Object> pp = new HashMap<String, Object>();
                //pp.put(PropertyIds.OBJECT_ID, "Name");

                pp.put("WorkflowNumber", nextLine[7]);
                pp.put("InvoiceDate", nextLine[2]);

                cmisobject.updateProperties(pp);

感谢任何帮助。

【问题讨论】:

    标签: java sharepoint metadata cmis opencmis


    【解决方案1】:

    @Albert,你是如何创建会话的?这可能是会话创建的问题。请在此处粘贴您的代码以创建会话。

    【讨论】:

    • 嗨,山姆,感谢您的回复。根据要求,这是我在创建会话时使用的代码 Session session = sessionFactory.createSession(parameter); RepositoryInfo info = session.getRepositoryInfo();
    • 创建会话时您在地图中传递的对象工厂参数是什么?它应该像 map.put(SessionParameter.OBJECT_FACTORY_CLASS,)
    • 谢谢山姆!我正在使用下面的冷创建会话:repositories = sessionFactory.getRepositories(parameter); for (Repository r : repositories) { System.out.println("找到的存储库:" + r.getName()); } 存储库存储库 = repositories.get(Integer.parseInt(repository_id));参数.put(SessionParameter.REPOSITORY_ID, repository.getId());会话会话 = sessionFactory.createSession(参数);
    • 我面临的主要问题是读取我的 csv 属性文件。似乎我没有正确阅读它。因为我试图用 CSV 文件中的属性填充 SharePoint 中的列名。我使用 csvreader 来读取 csv,但是当我传入例如 line[2] 时,我希望文档将填充文档该位置的整个值。可以贴一下代码,更清楚。感谢您的帮助
    猜你喜欢
    • 1970-01-01
    • 2021-05-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多