Error updating cm:categories using CMIS

cancel
Showing results for 
Search instead for 
Did you mean: 
Active Member II

Error updating cm:categories using CMIS

Jump to solution

Hi all

I get this error:

{"exception":"runtime","message":"03240394 Invalid node ref - does not contain forward slash: 590abfb1-a741-46dc-94c3-c6e8f6c53af5"}

when I try to set cm:categories for an object.

The id is a correct id of a category manually created in Alfresco (getted using CMIS).

I'm using PortCMIS and after creating a folder with all the aspects I try to update categories (I get the same error if I put the categories in the properties during the creation).

properties = new Dictionary<stringobject>(); properties.Add("cm:categories", categories); newFolder.UpdateProperties(properties,true);

categories is a List<string> with all the ID of the categories I need.

I guess it's the wrong way to put the categories in the properties.....

I'm becoming crazy!

Thank you for any advice

1 Solution

Accepted Solutions
Professional

Re: Error updating cm:categories using CMIS

Jump to solution

Here are a couple of things to keep in mind:

1. Categories are modeled in an aspect called cm:generalclassifiable. So if you are going to set categories on a doc you will need to add the secondary object type with an ID of "P:cm:generalclassifiable" to the node by updating the cmis:secondaryObjectTypeIds property.

2. The cm:categories property is not a list of Strings, it is a list of IDs. So instead of trying to set the property with a list of Strings, try setting it with a list of CMIS ID objects. 

Here is a gist that shows you how to add a category to a document using Groovy. It should give you an idea of how to do it.

View solution in original post

3 Replies
Professional

Re: Error updating cm:categories using CMIS

Jump to solution

Here are a couple of things to keep in mind:

1. Categories are modeled in an aspect called cm:generalclassifiable. So if you are going to set categories on a doc you will need to add the secondary object type with an ID of "P:cm:generalclassifiable" to the node by updating the cmis:secondaryObjectTypeIds property.

2. The cm:categories property is not a list of Strings, it is a list of IDs. So instead of trying to set the property with a list of Strings, try setting it with a list of CMIS ID objects. 

Here is a gist that shows you how to add a category to a document using Groovy. It should give you an idea of how to do it.

View solution in original post

Active Member II

Re: Error updating cm:categories using CMIS

Jump to solution

Hi Jeff,

I was already using your first advice: I create the new object putting all properties and also secondary object type to "P:cm:generalclassifiable" (if I check in Alfresco everything is ok).

I get all the ids of category that I want to link to the object using something like the code in your link but I get the error when I try exactly what specified in the code.

If I try to change list of string to list of CmisObjectId i get this error: 'Property 'cm:categories' is an Id property!' because PortCMIS check if for ids I'm using strings.

So probably it's not possible to set categories using CMIS.....but what could be the alternative?

In RestAPI it's not available any method for categories....

Active Member II

Re: Error updating cm:categories using CMIS

Jump to solution

I found my error!

I was using as category id their cmisSmiley SurprisedbjectId instead of alfcmis:nodeRef

Thank you for your support!