【发布时间】:2015-04-08 10:05:13
【问题描述】:
我无法使用 CMIS for Sharepoint 2013 更新文档。我不断收到错误消息“操作正在尝试更新不再是当前的对象。”我不知道为什么会这样。
请你检查一下我下面的代码有什么问题:
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters[DotCMIS.SessionParameter.BindingType] = BindingType.AtomPub;
parameters[DotCMIS.SessionParameter.AtomPubUrl] = url;
parameters[DotCMIS.SessionParameter.User] = username;
parameters[DotCMIS.SessionParameter.Password] = password;
parameters[SessionParameter.RepositoryId] = repositoryID;
SessionFactory factory = SessionFactory.NewInstance();
ISession session = factory.CreateSession(parameters);
ICmisObject cmisobj = session.GetObject("12345");
IDictionary<String, Object> properties = new Dictionary<String, Object>();
properties["cmis:name"] = "MyNewName";
IObjectId newId = cmisobj.UpdateProperties(properties);
感谢您的回复。我尝试添加 IOperationContext 但我仍然收到相同的错误。我是不是执行错了?
SessionFactory factory = SessionFactory.NewInstance();
ISession session = factory.CreateSession(parameters);
IOperationContext oc = session.CreateOperationContext();
ICmisObject cmisobj = session.GetObject("12345", oc);
IDictionary<String, Object> properties = new Dictionary<String, Object>();
properties["cmis:name"] = "MyNewName";
IObjectId newId = cmisobj.UpdateProperties(properties);
【问题讨论】:
标签: c# sharepoint sharepoint-2013 opencmis dotcmis