AnsweredAssumed Answered

Add a category to a document with Javascript

Question asked by nparry on Jul 5, 2007
Latest reply on Aug 23, 2007 by lock999
How do you add a category to a document with javascript?  I have done something like the following:


//Get category node
var nodeRef = search.luceneSearch("…");

//Get categories from file
var cats = file.properties["cm:categories"];

//Add new category
cats.push(nodeRef);

//Update file categories
file.properties["cm:categories"] = cats;

I'm using v2.0.  What am I doing wrong here?  I'm getting an error that says

Java class "java.lang.Object" has no public instance method or field named "1".

Thanks a lot,
Nick P

Outcomes