chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philip Barr <>
Subject Update Alfresco Aspect Properties From DotCMIS
Date Wed, 01 Feb 2012 13:05:10 GMT
I have managed to use DotCMIS to update aspect properties using the following code and have
a couple of questions. This code is an example and updates cm:description of a document for
which you know the id. Note that if you want to use this it requires a small change to the
source (from latest trunk) stated below the code.

    class Program
        static void Main()
            const string description = "this is a new description";

            const string repositoryId = "7270744f-c07c-48c9-aa01-ef90089785e3";
            string documentId = "workspace://SpacesStore/f8e3dc76-4781-49d6-b5d1-d3af1299ea80";

            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters[SessionParameter.BindingType] = BindingType.AtomPub;
            parameters[SessionParameter.AtomPubUrl] = "http://localhost:8082/alfresco/service/cmis";
            parameters[SessionParameter.User] = "admin";
            parameters[SessionParameter.Password] = "admin";
            parameters[SessionParameter.RepositoryId] = repositoryId;

            SessionFactory factory = SessionFactory.NewInstance();
            ISession session = factory.CreateSession(parameters);

            string changeToken = null; // not sure why I need this

            Properties props = new Properties();
            props.Extensions = CreateData(description).Extensions;
            session.Binding.GetObjectService().UpdateProperties(repositoryId, ref documentId,
ref changeToken, props, null);

        private static ExtensionsData CreateData(string description)
            ExtensionsData data = new ExtensionsData();
            data.Extensions = new List<ICmisExtensionElement>();
            CmisExtensionElement element = new CmisExtensionElement
                    Name = "alf:setAspects",
                    Namespace = "",
                    Children = new List<ICmisExtensionElement>
                        new CmisExtensionElement
                                Name = "alf:properties",
                                Namespace = "",
                                Children = new List<ICmisExtensionElement>
                                        new CmisExtensionElement
                                                Name = "cmis:propertyString",
                                                Namespace = "",
                                                Attributes = new Dictionary<string, string>
                                                Children = new List<ICmisExtensionElement>
                                                            new CmisExtensionElement
                                                                    Name = "cmis:value",
                                                                    Namespace = "",
                                                                    Value = description

            return data;

This works as long as you make the following change in converter.cs, line 1869 in Converter::CreateXMLElement(XmlDocument
doc, ICmisExtensionElement element) :
   result.Value = element.Value;
should be
   result.InnerText = element.Value;


1.       In the future will we be expected to add Extensions to the Properties as above, or
will we be able to use the ExtensionsData attribute on UpdateProperties call which is currently
ignored in the code?

2.       I am able to retrieve type information for an aspect by calling, for example, GetTypeDefinition("P:cm:titled").
But I do not know of any way to find out which aspects exist without finding a specific object
first. Is there any way to find out what aspects are applied to a *type* without getting hold
of an object first?
It would seem to me that, since cm:content is mapped to cmis:document, that calling GetTypeDefinition("cmis:document")
would return aspect information in the Extensions, but this does not seem to be the case.

3.       How actively is DotCMIS developed? If you are looking for devs I have spent some
time looking at the code to work this out and would be happy to help.

Kind Regards,
Phil Barr.


This e-mail contains information which is confidential and may be privileged and is for the
exclusive use of the recipient. If you are not the named recipient please contact the sender
immediately and delete the communication from your system. You are hereby notified that any
disclosure, distribution or copying of this communication, in whole or in part, is strictly
prohibited. It is the responsibility of the recipient to ensure that this message and its
attachments are virus free. Any views or opinions presented are solely those of the author
and do not necessarily represent those of the Company, its directors or officers unless otherwise
specifically stated. The Company is not responsible for any reliance placed on the information
contained herein and excludes all liability.

SynApps Solutions Limited is a company registered in England & Wales. Company Registration
No.: 047702224. VAT No.: 823778892

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message