cancel
Showing results for 
Search instead for 
Did you mean: 

DotCMIS API to associate a custom type to a document

rita_aiyar
Champ in-the-making
Champ in-the-making
Hi,

We are using the DotCMIS APIs to upload documents to a repository in alfresco. We are able to upload and add the default propertes to the document. We also have some custom types that have already been added into the alfresco environment. When we use the share url and then upload a document manually we can associate the custom type to the document and thereby add the values to the newly added properties that come with the type. We would like to do the same using dotCMIS APIs.

Could you help us to understand alongwith a sample code to associate a document with a custom type, preferably when we upload the document, else after we upload it. So that we can then populate the values of the properties associated with that type using DotCMIS APIs. Incase DotCMIS APIs do not support it then can you please suggest an alternative way to do it. We would need to do it programmatically.

I would appreciate if you could send a sample code that does it.

Regards,
Rita Aiyar
5 REPLIES 5

jpotts
World-Class Innovator
World-Class Innovator
Look at the "Creating a Document" example on <a href="http://chemistry.apache.org/dotnet/getting-started-with-dotcmis.html">this page</a>.

Now, instead of specifying "cmis:document" as the content type, specify the ID of your custom content type. For example, if you defined a custom type called "sc:whitepaper" then you would specify "D:sc:whitepaper" as the type in your CreateDocument call.

To set custom properties, just use the ID of the property. So you might set "sc:clientName" with a value, for example.

Hope that helps,

Jeff

rita_aiyar
Champ in-the-making
Champ in-the-making
Hi Jeff,

It works. Thanks a lot for it.

We have another question. Currently in our sample app, we tried uploading files up to 300MB and it worked. But in the real life scenario we would have documents up to 2 - 3 GB in size. Will the CMIS APIs support such large file upload. If not then is there an alternative way to do it.

Regards,
Rita

jpotts
World-Class Innovator
World-Class Innovator
CMIS 1.1 supports the ability to append a content stream. So you could essentially buffer your write by breaking your upload into chunks and then calling append content stream with each chunk, see http://chemistry.apache.org/java/0.11.0/maven/apidocs/org/apache/chemistry/opencmis/server/impl/brow...

Because this is CMIS 1.1 you must use Alfresco 4.2 or higher for this to work.

Jeff

rita_aiyar
Champ in-the-making
Champ in-the-making
Hi Jeff,

I am using DotCMIS that i downloaded 2 weeks back and the alfresco version that we are using is 4.2.2 However I don't get the option document.appendContentStream

Any idea what i am missing? Does DotCMIS support this feature? We are trying to consume Alfresco in our dotnet application and hence using DotCMIS.

Regards,
Rita

jpotts
World-Class Innovator
World-Class Innovator
I may be that the DotCMIS library hasn't been updated for CMIS 1.1 yet. If you are using 4.2.2 the server supports it. The worst case is that you could use the lower-level binding to invoke it directly. If you want to learn more about it by reading the spec, start <a href="http://docs.oasis-open.org/cmis/CMIS/v1.1/os/CMIS-v1.1-os.html#x1-150008">here</a>.

Jeff