dotCmis.CreateDocument与Sharepoint 2013
早上好, 我需要使用Apache chemistry dotcmis创建一组文档。但是,即使在最简单的情况下,SharePoint在调用folder.CreateDocument时也会触发CmisConstraintException。我已经测试了所有可用的版本状态,但这并不能解决问题。我使用dotCmis 0.6。顺便说一句,我的应用程序的露天部分运行良好 -阿明 这是我的模型dotCmis.CreateDocument与Sharepoint 2013,sharepoint,cmis,dotcmis,Sharepoint,Cmis,Dotcmis,早上好, 我需要使用Apache chemistry dotcmis创建一组文档。但是,即使在最简单的情况下,SharePoint在调用folder.CreateDocument时也会触发CmisConstraintException。我已经测试了所有可用的版本状态,但这并不能解决问题。我使用dotCmis 0.6。顺便说一句,我的应用程序的露天部分运行良好 -阿明 这是我的模型 using DotCMIS; using DotCMIS.Client; using DotCMIS.Client.
using DotCMIS;
using DotCMIS.Client;
using DotCMIS.Client.Impl;
using DotCMIS.Data.Impl;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Dictionary<string, string> parameters;
parameters = new Dictionary<string, string>();
parameters[SessionParameter.BindingType] = BindingType.AtomPub;
parameters[SessionParameter.AtomPubUrl] = "http://coretwo/" + "websites/migrationtest" + "/_vti_bin/cmis/rest?getRepositories";
parameters[SessionParameter.User] = "joe@test.org";
parameters[SessionParameter.Password] = "whoknows";
var session = SessionFactory.NewInstance().GetRepositories(parameters).Single(r => r.Name.Equals("Dokumente")).CreateSession();
var rFolder = session.GetRootFolder();
IDictionary<string, object> properties = new Dictionary<string, object>();
properties[PropertyIds.Name] = "Hello World Document";
properties[PropertyIds.ObjectTypeId] = "cmis:document";
byte[] content = UTF8Encoding.UTF8.GetBytes("Hello World!");
ContentStream contentStream = new ContentStream();
contentStream.FileName = "hello-world.txt";
contentStream.MimeType = "text/plain";
contentStream.Length = content.Length;
contentStream.Stream = new MemoryStream(content);
IDocument doc = rFolder.CreateDocument(properties, contentStream, null);
}
}
使用DotCMIS;
使用DotCMIS.Client;
使用DotCMIS.Client.Impl;
使用DotCMIS.Data.Impl;
使用制度;
使用System.Collections.Generic;
使用System.IO;
使用System.Linq;
使用系统文本;
使用System.Threading.Tasks;
命名空间控制台应用程序1
{
班级计划
{
静态void Main(字符串[]参数)
{
字典参数;
参数=新字典();
参数[SessionParameter.BindingType]=BindingType.AtomPub;
参数[SessionParameter.AtomPubUrl]=”http://coretwo/“+”网站/migrationtest“+”/\u vti\u bin/cmis/rest?getRepositories”;
参数[SessionParameter.User]=”joe@test.org";
参数[SessionParameter.Password]=“谁知道”;
var session=SessionFactory.NewInstance().GetRepositories(参数).Single(r=>r.Name.Equals(“Dokumente”)).CreateSession();
var rFolder=session.GetRootFolder();
IDictionary properties=新字典();
properties[PropertyId.Name]=“Hello World文档”;
properties[PropertyId.ObjectTypeId]=“cmis:document”;
byte[]content=UTF8Encoding.UTF8.GetBytes(“Hello World!”);
ContentStream ContentStream=新ContentStream();
contentStream.FileName=“hello world.txt”;
contentStream.MimeType=“text/plain”;
contentStream.Length=content.Length;
contentStream.Stream=newmemoryStream(内容);
IDocument doc=rFolder.CreateDocument(属性、内容流、空);
}
}
}墨菲无处不在……我在这里发布几分钟后就找到了答案。诀窍是在调用CreateDocument时使用DotCMIS.Enums.VersioningState.CheckedOut,然后进行签入 以下是对我有效的方法:
IDocument doc = rFolder.CreateDocument(properties, contentStream, DotCMIS.Enums.VersioningState.CheckedOut);
doc.CheckIn(true, null, null, "Checkin", null, null, null);