cancel
Showing results for 
Search instead for 
Did you mean: 

creating documents

sarag
Champ in-the-making
Champ in-the-making
Hi! First of all sorry for my english  Smiley Surprisedops:

Two simple questions:

1 - How can I create documents on a specific folder? Now I only create them on "/app:company_home"

2 - When I create a new document, How can I assign it to a specific category?

Thanks in advance
Sara
5 REPLIES 5

sarag
Champ in-the-making
Champ in-the-making
I already create documents on a specific space, but I don't know yet how to assign categories to a document.

Thanks.
Sara.

kevinr
Star Contributor
Star Contributor
Are you using the web-client or performing the operations in code using an API?

If you are using the web-client, then go into the Details screen for a document, and expand the Category panel. Then click Allow Categorization and finally click the edit properties icon in the top-right of the panel.

If you are using the API, then you need to apply the "cm:generalclassifiable" aspect and add category NodeRef's to the multi-value "cm:categories" property (search for this in contentModel.xml)

Thanks,

Kevin

sarag
Champ in-the-making
Champ in-the-making
I'm using the API.

I create a document with his attributes like this:

titledProps[0] = new NamedValue(Constants.PROP_NAME, "archive.txt");
titledProps[0] = new NamedValue(Constants.PROP_TITLE, "archive");


but I don't know how to assign a category. There are some PROP like name, title, etc. for the category?

Thanks.

avro
Champ in-the-making
Champ in-the-making
Hi,

I'm as troubled as sarag was last year with this same issue.

Which is the code to assign a category to a document?

Thanks.

andy
Champ on-the-rise
Champ on-the-rise
Hi

You need an aspect that has a property of type d:category and with some specific index settings - see  cm:generalclassifiable in contentModel.xml.

Then you apply this aspect to a node, and assign the noderef of the category or categories that apply to that property. Categories are a specific type. (This area of the wiki needs updating)

We expose cm:generalclassifiable in the UI. You can actually have as many classification aspects as you like.

See the category tests for more examples.

Andy