Adding custom type while uploading document using web script

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2012 10:37 AM
Hello Friends,
I am using Alfresco 4.0.b community edition with default solr implementation.
I am uploading documents in alfresco using upload web script as mentioned at http://wiki.alfresco.com/wiki/Web_Scripts_Examples#Upload_Script
I have created a web script for searching documents using CMIS query.
I have added some meta tags while uploading the documents and want to search documents using those metatags.
For this purpose i have created a custom document type prop:documents and added my custom meta tags like prop
ropertyid, prop:agreementid to it.
Now while uploading the document i have to add prop:documents as object type.
So can someone please suggest me how to add custom object type while uploading document using upload web script.
Thanks,
Arpit
I am using Alfresco 4.0.b community edition with default solr implementation.
I am uploading documents in alfresco using upload web script as mentioned at http://wiki.alfresco.com/wiki/Web_Scripts_Examples#Upload_Script
I have created a web script for searching documents using CMIS query.
I have added some meta tags while uploading the documents and want to search documents using those metatags.
For this purpose i have created a custom document type prop:documents and added my custom meta tags like prop

Now while uploading the document i have to add prop:documents as object type.
So can someone please suggest me how to add custom object type while uploading document using upload web script.
Thanks,
Arpit
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2012 12:04 PM
During the upload process in the POST WebScript, you can specialize your new node using the specializeType method available in the ScriptNode, in this way:
// create document in company home for uploaded file upload = companyhome.createFile("upload" + companyhome.children.length + "_" + filename) ; upload.properties.content.write(content); upload.properties.content.setEncoding("UTF-8"); upload.properties.content.guessMimetype(filename); upload.specializeType("prop:documents"); upload.properties["yourCustomPrefix:yourCustomProperty1"] = value1; upload.properties["yourCustomPrefix:yourCustomProperty2"] = value2; … … upload.properties.title = title; upload.properties.description = description; upload.save(); // setup model for response template model.upload = upload;
Hope this helps.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2012 04:01 AM
Thanks Dear!!! It helped..

