这是我的情景: 我正在尝试使用DotCMIS 0.6在Alfresco(版本4.2.0社区)上传文件。
这是我的代码:
Dictionary<string, object> properties = new Dictionary<string, object>();
properties.Add("cmis:name", "name.pdf");
//other properties and contentStream initialization
startFolder.CreateDocument(properties, contentStream, (DotCMIS.Enums.VersioningState)versioningState)
我在网址上使用AtomPub绑定
http://[host]:[port]/alfresco/api/-default-/public/cmis/versions/1.0/atom
当尝试上传文件时,我收到此错误:
Utilities.CMIS.Exceptions.CMISException: Not Found ---> Utilities.CMIS.Exceptions.CMISException: Not Found ---> Utilities.CMIS.Exceptions.CMISException: Not Found ---> DotCMIS.Exceptions.CmisObjectNotFoundException: Not Found
at DotCMIS.Binding.AtomPub.AbstractAtomPubService.Read(UrlBuilder url)
at DotCMIS.Binding.AtomPub.AbstractAtomPubService.GetTypeDefinitionInternal(String repositoryId, String typeId)
at DotCMIS.Binding.AtomPub.RepositoryService.GetTypeDefinition(String repositoryId, String typeId, IExtensionsData extension)
at DotCMIS.Binding.Impl.BindingRepositoryService.GetTypeDefinition(String repositoryId, String typeId, IExtensionsData extension)
at DotCMIS.Client.Impl.Session.GetTypeDefinition(String typeId)
at DotCMIS.Client.Impl.ObjectFactory.ConvertProperties(IDictionary`2 properties, IObjectType type, HashSet`1 updatabilityFilter)
at DotCMIS.Client.Impl.Session.CreateDocument(IDictionary`2 properties, IObjectId folderId, IContentStream contentStream, Nullable`1 versioningState, IList`1 policies, IList`1 addAces, IList`1 removeAces)
at DotCMIS.Client.Impl.Folder.CreateDocument(IDictionary`2 properties, IContentStream contentStream, Nullable`1 versioningState, IList`1 policies, IList`1 addAces, IList`1 removeAces, IOperationContext context)
at DotCMIS.Client.Impl.Folder.CreateDocument(IDictionary`2 properties, IContentStream contentStream, Nullable`1 versioningState)
at Utilities.CMIS.CMISClient.CreateDocument(FileInfo fileToUpload, String fileNameToSave, String objectType, String folderPath, Dictionary`2 properties, VersioningState versioningState, String checkInComment)
--- End of inner exception stack trace ---
at Utilities.CMIS.CMISClient.CreateDocument(FileInfo fileToUpload, String fileNameToSave, String objectType, String folderPath, Dictionary`2 properties, VersioningState versioningState, String checkInComment)
at Utilities.CMIS.CMISClient.CreateDocument(String fileToUpload, String filenameToSave, String CMISObjectType, String folderPath, Dictionary`2 properties, Dictionary`2 foldersACL, VersioningState versioningState, String checkInComment)
--- End of inner exception stack trace ---
at Utilities.CMIS.CMISClient.CreateDocument(String fileToUpload, String filenameToSave, String CMISObjectType, String folderPath, Dictionary`2 properties, Dictionary`2 foldersACL, VersioningState versioningState, String checkInComment)
at Utilities.CMIS.CMISClient.CreateDocumentByModel(String fileToUpload, Dictionary`2 kofaxValues)
--- End of inner exception stack trace ---
at Utilities.CMIS.CMISClient.CreateDocumentByModel(String fileToUpload, Dictionary`2 kofaxValues)
at KofaxTextExportToDB.Program.Main(String[] args)
答案 0 :(得分:1)
您还必须设置cmis:objectTypeId
属性,并且此对象类型必须存在。看起来您提供的是Alfresco中未知的对象类型。
尝试添加此行:
properties.Add("cmis:objectTypeId", "cmis:document");