CmisSync.Lib.Cmis.CmisUtils.FetchMetadata C# (CSharp) Method

FetchMetadata() public static method

Retrieve the CMIS metadata of a document.
public static FetchMetadata ( ICmisObject o, IObjectType typeDef ) : string[]>.Dictionary
o ICmisObject
typeDef IObjectType
return string[]>.Dictionary
        public static Dictionary<string, string[]> FetchMetadata(ICmisObject o, IObjectType typeDef)
        {
            Dictionary<string, string[]> metadata = new Dictionary<string, string[]>();

            IList<IPropertyDefinition> propertyDefs = typeDef.PropertyDefinitions;

            // Get metadata.
            foreach (IProperty property in o.Properties)
            {
                // Mode
                string mode = "readonly";
                foreach (IPropertyDefinition propertyDef in propertyDefs)
                {
                    if (propertyDef.Id.Equals("cmis:name"))
                    {
                        Updatability updatability = propertyDef.Updatability;
                        mode = updatability.ToString();
                    }
                }

                // Value
                if (property.IsMultiValued)
                {
                    metadata.Add(property.Id, new string[] { property.DisplayName, mode, property.ValuesAsString });
                }
                else
                {
                    metadata.Add(property.Id, new string[] { property.DisplayName, mode, property.ValueAsString });
                }
            }

            return metadata;
        }