cancel
Showing results for 
Search instead for 
Did you mean: 

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

alnedru
Champ in-the-making
Champ in-the-making
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["cmisSmiley SurprisedbjectId"].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
cmisSmiley SurprisedbjectTypeId
cmis:versionSeriesCheckedOutId
cmis:name
cmis:contentStreamMimeType
cmis:versionSeriesId
cmis:creationDate
cmis:changeToken
cmis:versionLabel
cmis:isLatestVersion
cmis:isVersionSeriesCheckedOut
cmis:lastModifiedBy
cmis:createdBy
cmis:checkinComment
cmisSmiley SurprisedbjectId
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 cmisSmiley Very Happyescription, 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.
2 REPLIES 2

alnedru
Champ in-the-making
Champ in-the-making
BUMP, still no solution, any help?

jpotts
World-Class Innovator
World-Class Innovator
Title and description are defined in aspects. CMIS 1.0 has no idea what aspects are. Therefore you must workaround that problem. If you were using the OpenCMIS library for Java you could use the OpenCMIS Extension for Alfresco which knows how to deal with aspects. I do not know if something similar exists for DotCMIS. You'll have to ask around.

Starting with Alfresco 4.2.e, Alfresco supports CMIS 1.1 which has native support for aspects (in CMIS 1.1, aspects are called "secondary types"). So, when DotCMIS supports CMIS 1.1, you can use it with Alfresco 4.2.e to get and set properties defined in an aspect and you won't need an extension.

Jeff