cancel
Showing results for 
Search instead for 
Did you mean: 

How to Install Alfresco OpenCMIS Extension

julio_aescobar
Champ in-the-making
Champ in-the-making
Hello everybody,

I am creating a web application in .net (C# + dotcmis) and i want to create a document and then add some properties to this document.

I read that i need to install Alfresco OpenCmis extension to can work with alfresco aspects and properties.

My code is:

To create documents:

        public void PutFile(CMISDocument document)
        {
            IObjectId cmisObjectFolder = (IObjectId)session.GetObject(document.FolderId);

            IDictionary<string, object> properties = new Dictionary<string, object>();
            properties[PropertyIds.Name] = document.ContentStreamFileName;
            properties[PropertyIds.ObjectTypeId] = "cmis:document";
            properties[PropertyIds.CreationDate] = DateTime.Now;

            ContentStream contentStream = new ContentStream();
            contentStream.FileName = document.ContentStreamFileName;
            contentStream.MimeType = document.ContentStreamMimeType;
            contentStream.Length = document.Stream.Length;
            contentStream.Stream = document.Stream;

            IObjectId objectId = session.CreateDocument(properties, cmisObjectFolder, contentStream, DotCMIS.Enums.VersioningState.None);
           
            PutFileDetail(objectId,document.Owner);
        }


To add aspects and properties:


        internal void PutFileDetail(IObjectId objectId,string actorIdCard)
        {
            ICmisObject cmisObject = session.GetObject(objectId);

            IDictionary<string, object> properties = new Dictionary<string, object>();
            properties[PropertyIds.ObjectTypeId] = "adm:aridoctypBase";
            properties["adm:actidcard"] = actorIdCard;

            IObjectId newId = cmisObject.UpdateProperties(properties);

            if (newId.Id == cmisObject.Id)
            {
                // the repository updated this object - refresh the object
                cmisObject.Refresh();
            }
            else
            {
                // the repository created a new version - fetch the new version
                cmisObject = session.GetObject(newId);
            }
        }




The error message is:

Mensaje: Property +'adm:actidcard' is not valid for this type!   
Origen: DotCMIS   
Detalle:    at DotCMIS.Client.Impl.ObjectFactory.ConvertProperties(IDictionary`2 properties, IObjectType type, HashSet`1 updatabilityFilter)
   at DotCMIS.Client.Impl.AbstractCmisObject.UpdateProperties(IDictionary`2 properties, Boolean refresh)
   at DotCMIS.Client.Impl.AbstractCmisObject.UpdateProperties(IDictionary`2 properties)
   at CustomSystemFrameworks.CMISIntegration.CMISIntegrationRepository.PutFileDetail(IObjectId objectId, String actorIdCard) in C:\Corp\Projects\Colombia\CustomSystemFrameworks\AriDocsIntegration\CMISIntegrationRepository.cs:line 268
   at CustomSystemFrameworks.CMISIntegration.CMISIntegrationRepository.PutFile(CMISDocument document) in C:\Corp\Projects\Colombia\CustomSystemFrameworks\AriDocsIntegration\CMISIntegrationRepository.cs:line 257
   at WebUI.AriDocs.ibtnSave_Click(Object sender, ImageClickEventArgs e) in c:\Corp\Projects\Colombia\Presentation\AriDocs.aspx.cs:line 257



Thanks for all!
4 REPLIES 4

mrogers
Star Contributor
Star Contributor
You don't need the extension with 4.2 that has cmis 1.1

Hello,

mrogers.

Thanks for you answer.

Product Version   4.2.0 (r56674-b4848)
Specification Title   CMIS Version 1.0 OASIS Standard
Version Supported   1.0
Product Name   Alfresco Repository (Community)

I am using a bitnami image and amazon cloud.

As you can see, i do not have cmis 1.1

what can i do?

jpotts
World-Class Innovator
World-Class Innovator
If "version supported" is returning as "1.0" and what you really wanted was "1.1" it means you are using the wrong service URL.
In 4.2 the correct CMIS service URLs are as follows:

CMIS 1.0, AtomPub: http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.0/atom
CMIS 1.1, AtomPub: http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom
CMIS 1.1, Browser: http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser

The Web Services binding URL did not change in 4.2.

Jeff

hpatel
Champ in-the-making
Champ in-the-making
Hi:

I am using DOTCMIS library to create document in Alfresco Enterprise version 5.0, when I try to create document using Atom-pub Binding 1.1 I am getting different types of error which are follow…

1)When I try to create Folder object using following
tagetFolder = (Folder)session.GetObjectByPath("<path>");

Property 'cm:description' doesn't exist!

I tried to debug this in the source code provided and found that when we use 1.1 binding , the property is replaced by “cmis:description”. Found more few such properties which either is not supported using 1.1 binding or its name got changed…

2)After overcoming the issue in point 1, now I found some strange issue related to Content Model that is define which is using Aspects. When I create document by setting the value for “cmisSmiley SurprisedbjectTypeId” as name of the content model type  (which uses Aspects) and setting all the property values for Aspects , than i am getting the exception which say that

Property '<name of aspect property>' is not valid for this type!

I have verified weather Aspect is part of my Document which I have created by following

Document doc = tagetFolder.CreateDocument(properties, contentStream, null) as Document;
var allaspects= doc.GetPropertyValue("cmis:secondaryObjectTypeIds");
.. //check if my aspect is part of allaspects
// if so add the values for all the properties of aspect and update the document properties…

          Dictionary<string, object> parameters2 = new Dictionary<string, object>();

            parameters2.Add("<aspect property1", "value for aspect");
            parameters2.Add("<aspect property2", "value for aspect");
     doc.UpdateProperties(parameters2);



Please advise.