0

这是我的场景:我正在尝试使用 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)

我在 url 上使用 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)
4

1 回答 1

1

您还必须设置cmis:objectTypeId属性,并且此对象类型必须存在。看起来您提供的对象类型在 Alfresco 中是未知的。

尝试添加这一行:

properties.Add("cmis:objectTypeId", "cmis:document");
于 2015-03-03T11:13:57.807 回答