cancel
Showing results for 
Search instead for 
Did you mean: 

add multiple categories to a content

mphasis
Champ in-the-making
Champ in-the-making
Hi,


I am trying to add multiple categories while uploading a content in my alfresco repository, but not even a singe category is getting added.

I tried this statement
upload.properties["cm:categories"] =catNodes;

but still not working for me.

Any ideas?
6 REPLIES 6

algoworks
Champ in-the-making
Champ in-the-making
Can you please share the whole code which does this? I mean the code where you get the category which is to be updated, then how do you set it to a list… etc. We hope we might help then.

Thanks,
Algoworks Alfresco Team
http://www.algoworks.com

mphasis
Champ in-the-making
Champ in-the-making
I am adding a snippet hope it helps upload is the object i am using in my webscript

   
var upload=folderPathNodeID.createFile(filename);
   upload.properties.content.write(content);
   upload.properties.content.mimetype = mimeType;
   upload.properties.title = title;
   upload.properties.description = description;
   upload.properties.author = authorNameArr[arrCount];
   logger.log("catSearchQuery"+catSearchQuery);
   logger.log("catNodes"+catNodes);
   upload.properties["cm:categories"] =catNodes;                                                
   upload.save();

where I am currently trying to add catNodes to the content which i guess is wrong and hence not able to append the category to my content
catNodes  value–> "catNodesNode Type: {http://www.alfresco.org/model/content/1.0}category, Node Aspects: [{http://www.alfresc
o.org/model/system/1.0}referenceable, {http://www.alfresco.org/model/content/1.0}auditable]"


and
catSearchQuery is the actual category which i need to append/ add to my content currently it is for single category however i even need to implement for multiple category–>

"PATH:"/cm:generalclassifiable//cm:Languages/cm:English""

Thanks.

algoworks
Champ in-the-making
Champ in-the-making
Getting and setting categories are already discussed previously. Please visit the following link:

http://forums.alfresco.com/en/viewtopic.php?f=36&t=10048#p35567

Hope this helps.

Thanks,
Algoworks Alfresco Team
http://www.algoworks.com

mphasis
Champ in-the-making
Champ in-the-making
well thanks for the link.

But there is one addition to be done for both code to work. It is not mentioned in that link


upload.addAspect("cm:generalclassifiable");

Anyway thanks a ton for prompt reply.

algoworks
Champ in-the-making
Champ in-the-making
It would be great if you could just add your suggestion to that thread. This will be useful for other members.

Thanks,
Algoworks Alfresco Team
http://www.algoworks.com

mphasis
Champ in-the-making
Champ in-the-making
sure will do that.

Again the link was useful for adding multiple categories.