2015-02-24 36 views
0

這是我的場景: 我試圖使用DotCMIS 0.6在Alfresco(4.2.0版社區)上傳文件。當向Alfresco上傳文件時出現「CmisObjectNotFoundException」

這是我的代碼:

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的URL

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) 

回答

1

您必須設置cmis:objectTypeId屬性,並且此對象類型必須存在。看起來你正在提供一個在Alfresco中未知的對象類型。

嘗試加入這一行:

properties.Add("cmis:objectTypeId", "cmis:document"); 
相關問題