title: How Can i associate an aspect and his property to a document in C# DotCmis Alfresco
body: <p>I am working in a .net web application than need to be able to create documents in Alfresco and then associate a particular aspect and his prperties to those documents.</p>
  
  <p>I created my aspect (nameModel.xml, name-model-context.xml all this files in the extension folder, name.properties in messages folder and custom-slingshot-application-context.xml share-config-custom.xml in the web-extension folder) in /opt/bitnami/apache-tomcat/shared/classes/alfresco/ path.</p>
  
  <p>In my C# code, i have two methods:</p>
  
  <pre><code>        public void PutFile(CMISDocument document)
      {
          IObjectId cmisObjectFolder = (IObjectId)session.GetObject(document.FolderId);
  
          IDictionary&lt;string, object&gt; properties = new Dictionary&lt;string, object&gt;();
          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);
      }
  
          internal void PutFileDetail(IObjectId objectId,string actorIdCard)
      {
          ICmisObject cmisObject = session.GetObject(objectId);
  
          IDictionary&lt;string, object&gt; properties = new Dictionary&lt;string, object&gt;();
          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);
          }
      }
  </code></pre>
  
  <p>With this code i have as result a error: </p>
  
  <p>The first one is for create the document and the second one is for add the aspect and his properties.</p>
  
  <p>I was looking for a answer, and i finded this: <a href="http://docs.alfresco.com/4.0/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Fconcepts%2Fopencmis-ext-intro.html" rel="nofollow">http://docs.alfresco.com/4.0/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Fconcepts%2Fopencmis-ext-intro.html</a></p>
  
  <p>But a really do not know how install Alfresco OpenCMIS Extension; they say that i need put the jar file in my class path. But i do not know what is my class path in bitnami virtual machine.</p>
  
  <p>Other thing is if i forgot something in the creation of my aspect.</p>
  
  <p>pd: It is important but nor urgent for me, that the way to do it could be work if one day a need change Alfresco to Sharepoint or another else enterprise content management</p>
  
  <p>I will apreciate any help.</p>
  
  <hr>
  
  <p>Thanks! Do you know where can i see a good example? I think that the first point: i need change my model. In this moment i have the properties inside of aspect tags. I will need create the types and the properties ... can you tell me if i am going in good way...?</p>
  
  <p>This is my model xml file (aridocsModel.xml) resume:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;model name="adm:aridocsModel" xmlns="http://www.alfresco.org/model/dictionary/1.0"&gt;
  
          ...
  
          &lt;aspects&gt;
                  &lt;aspect name="adm:aridocsBase"&gt;
                  &lt;title&gt;AriDocs Base&lt;/title&gt;
                                  &lt;properties&gt;
                                    &lt;property name="adm:createdate"&gt;
                                            &lt;type&gt;d:date&lt;/type&gt;
                                    &lt;/property&gt;
                                    &lt;property name="adm:disabledate"&gt;
                                            &lt;type&gt;d:date&lt;/type&gt;
                                    &lt;/property&gt;
                                    &lt;property name="adm:artiddoc"&gt;
                                            &lt;type&gt;d:text&lt;/type&gt;
                                    &lt;/property&gt;
                                    &lt;property name="adm:accnumber"&gt;
                                            &lt;type&gt;d:text&lt;/type&gt;
                                    &lt;/property&gt;
                                    &lt;property name="adm:actidcard"&gt;
                                            &lt;type&gt;d:text&lt;/type&gt;
                                    &lt;/property&gt;
                                  &lt;/properties&gt;
                  &lt;/aspect&gt;
          &lt;/aspects&gt;
  &lt;/model&gt;
  </code></pre>
  
  <p>Now, how i can not work with aspects; and i need types ... </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;model name="adm:aridocsModel" xmlns="http://www.alfresco.org/model/dictionary/1.0"&gt;
  
          ...
  
          &lt;types&gt;
                  &lt;type name="adm:aridoctypBase"&gt;
                          &lt;title&gt;Ari Docs Type Base&lt;/title&gt;
                          &lt;parent&gt;cm:content&lt;/parent&gt;
                             &lt;properties&gt;
                                    &lt;property name="adm:createdate"&gt;
                                            &lt;type&gt;d:date&lt;/type&gt;
                                    &lt;/property&gt;
                                    &lt;property name="adm:disabledate"&gt;
                                            &lt;type&gt;d:date&lt;/type&gt;
                                    &lt;/property&gt;
                                    &lt;property name="adm:artiddoc"&gt;
                                            &lt;type&gt;d:text&lt;/type&gt;
                                    &lt;/property&gt;
                                    &lt;property name="adm:accnumber"&gt;
                                            &lt;type&gt;d:text&lt;/type&gt;
                                    &lt;/property&gt;
                                    &lt;property name="adm:actidcard"&gt;
                                            &lt;type&gt;d:text&lt;/type&gt;
                                    &lt;/property&gt;
                                  &lt;/properties&gt;
                  &lt;/type&gt;
          &lt;/types&gt;
  
          ...
          &lt;!-- i need put the aspect here... Even if i will work with types... --&gt;
          ...
  
  &lt;/model&gt;
  </code></pre>
  
  <p>I will appreciate any advice.</p>