0

this is my scenario: I'm trying to upload a file on an Alfresco (version 4.2.0 Community) using DotCMIS 0.6.

This is my code:

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)

I am using AtomPub binding on the url

http://[host]:[port]/alfresco/api/-default-/public/cmis/versions/1.0/atom

and when trying to upload the file I'm getting this error:

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)
Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
Albirex
  • 283
  • 1
  • 2
  • 13

1 Answers1

1

You have to set the cmis:objectTypeId property as well and this object type must exist. Looks like you are providing an object type that is unknown in Alfresco.

Try adding this line:

properties.Add("cmis:objectTypeId", "cmis:document");
Florian Müller
  • 3,215
  • 1
  • 14
  • 11