我无法使用 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);