AnsweredAssumed Answered

CMIS set document properties (like title, description, reference)

Question asked by alnedru on Mar 22, 2013
Latest reply on Jan 7, 2014 by jpotts
I'm using dotCMIS library to access CMIS for alfresco.

But I have a small issue which i cannot solve directly, basically I want to retrieve a document and set some values in properties, like in title, in description and reference etc …

So if in alfresco portal i go to a particular documetn and click on modify properties, I see all those propertis and at that time they are empty, i can set the manually yeah but i would like to do it programmatically.

So i have the following code, just to check what properties there are:

<c>
SessionFactory factory = SessionFactory.NewInstance();
            IList<DotCMIS.Client.IRepository> repositories = factory.GetRepositories(parameters);
            DotCMIS.Client.ISession session = repositories[0].CreateSession();

            string queryGetDoc = "SELECT * FROM cmis:document WHERE cmis:name='Document1'";
            IItemEnumerable<IQueryResult> docResults = session.Query(queryGetDoc, false);
            IQueryResult docHit = docResults.FirstOrDefault();
            string docId = docHit["cmis:objectId"].FirstValue.ToString();

            IDocument document = session.GetObject(docId) as IDocument;

            IList<IProperty> listOfProperties = document.Properties;
           

            foreach(IProperty p in listOfProperties)
            {
                Console.WriteLine(p.QueryName);
            }
            Console.ReadLine();
</c>

So basically I'll retrieve the document, yeah and ill loop through all the properties and ill get the following:

cmis:isLatestMajorVersion
cmis:contentStreamLength
cmis:contentStreamId
cmis:versionSeriesCheckedOutBy
cmis:objectTypeId
cmis:versionSeriesCheckedOutId
cmis:name
cmis:contentStreamMimeType
cmis:versionSeriesId
cmis:creationDate
cmis:changeToken
cmis:versionLabel
cmis:isLatestVersion
cmis:isVersionSeriesCheckedOut
cmis:lastModifiedBy
cmis:createdBy
cmis:checkinComment
cmis:objectId
cmis:isImmutable
cmis:isMajorVersion
cmis:baseTypeId
cmis:contentStreamFileName
cmis:lastModificationDate

So ths are all the properties, but what i do not understand is, where is the cmis:Title or cmis:Description, is there another way to approach those properties, or what is the deal with them?

How can i set the properties?

I checked library of java for accessing cmis it says that more or less i should do this …

Does it mean that my alfresco portal doesn't have those properties accessible, or … i really have no idea where to look for it ….

Any advise would be welcome.

Outcomes