AnsweredAssumed Answered

Update Alfresco Aspect Properties Via DotCMIS

Question asked by phil_barr on Jan 25, 2012
Latest reply on Dec 9, 2015 by mrogers
Hi all,

I have successfully managed to retrieve attributes belonging to an aspect (such as cm:description and cm:title) using the Extensions available through the DotCmis API. Is there any way to update these properties using DotCmis also?

I have tried adding the aspect properties to the properties passed in the document.UpdateProperties() method, which throws a "property does not exist" error.
I have tried manipulating the values of the CmisExtensionElements, but these were just ignored during the call to UpdateProperties() and the values stayed the same.

Below is my code for retrieving the properties from a document:
            IList<ICmisExtensionElement> cmisExtensionElements = cmisObject.GetExtensions(ExtensionLevel.Properties);
            foreach (ICmisExtensionElement element in cmisExtensionElements)
            {
                foreach (var v in element.Children)
                {
                    if (v.Name == "alf:properties")
                    {
                        if (v.Children != null)
                        {
                            foreach (var a in v.Children)
                            {
                                string propId = a.Attributes["propertyDefinitionId"];
                                string displayName = a.Attributes["displayName"];

                                if (a.Children == null || a.Children.Count == 1)
                                {
                                    string value = a.Children == null ? null : a.Children[0].Value;
                                    DoSomethingWithValue(value);
                                }
                            }
                        }
                    }
                }
            }

Kind Regards,
Phil.

Outcomes