Add New Custom Properties in Custom Model

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

Add New Custom Properties in Custom Model

Jump to solution

Hello,
I've created custom model with PortCmis and C#, with some custom aspects. Now I want to add some more custom aspects to that model. I've tried something like this:

var modelObject = session.GetObject("here-is-custom-model-id");

var aspectsTemp = modelObject.GetPropertyValue("cmis:secondaryObjectTypeIds");

IList aspects = (IList)aspectsTemp;
aspects.Add("P:goran:fourthAspect");

IDictionary<string, object> props = new Dictionary<string, object>();
props["cmis:secondaryObjectTypeIds"] = aspects;

modelObject.UpdateProperties(props, true);

 

But I'm getting this error: "Invalid secondary type id P:goran:fourthAspect".
Is there any solution how to add new custom aspect to previously created custom model?
Thanks.

 

1 Solution

Accepted Solutions
kaynezhang
Advanced

Re: Add New Custom Properties in Custom Model

Jump to solution

You need  to retrieve content of the model document  which is an xml .operate the xml (add aspect definition under aspects sub elements)  and save the xml content back to the model node.

View solution in original post

2 Replies
kaynezhang
Advanced

Re: Add New Custom Properties in Custom Model

Jump to solution

You need  to retrieve content of the model document  which is an xml .operate the xml (add aspect definition under aspects sub elements)  and save the xml content back to the model node.

EddieMay
Alfresco Employee

Re: Add New Custom Properties in Custom Model

Jump to solution

Hi @goranche89 

Great that you accepted the solution - thanks!

Cheers,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!