cancel
Showing results for 
Search instead for 
Did you mean: 

Add New Custom Properties in Custom Model

goranche89
Champ on-the-rise
Champ on-the-rise

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 ACCEPTED ANSWER

kaynezhang
World-Class Innovator
World-Class Innovator

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 answer in original post

2 REPLIES 2

kaynezhang
World-Class Innovator
World-Class Innovator

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
World-Class Innovator
World-Class Innovator

Hi @goranche89 

Great that you accepted the solution - thanks!

Cheers,

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