.NET – Programmatically create users in Alfresco DMS

This post aims to show how to create user accounts in the OpenSource Document Mangement System “Alfresco” with .NET. Alfresco provides several web services to interact with. But I found it very hard to get appropriate information how to use these services. In this example you will see how to create a new user in the user database of Alfresco with .NET and dotCMIS.

Please make sure, that your Alfresco installation supports SSL (see “Enable SSL on Tomcat Apache Web Server“) since the Administration web services of Alfresco are accessable only over HTTPS. Secondly, you need to know Alfresco’s administration username and password. If you can access Alfresco’s web services over the SSL port (normally 443 or 8443), you’re ready to start building your .NET project.


Some of Alfresco’s web services methods require as parameters some of the values defined in the class below. I have found those constants in Alfresco’s Java API and converted it to C#:



This is a simple class that holds some information about a user. It just shows you, which properties are required to setup a new user account in Alfresco. You can replace this class with one of your implementation, just make sure you have these properties defined.


This class provides methods to create and remove user accounts in Alfresco’s user management. It makes use of Alfresco administration web services and Alfresco’s CMIS web services. You need to add a WCF “Service Reference” of “https://server.name:PORT/alfresco/api/AdministrationService?wsdl” to your .NET project. Ensure you’re calling the web services over HTTPS and not HTTP.


That’s it. Now, you should be able to create and remove user accounts in Alfresco!

.NET – Add documents in Alfresco DMS using Aspects and dotCMIS

This example shows how to add documents in Alfresco by using aspects and dotCMIS. If you’re not familiar with creating custom models in Alfresco, this step-by-step tutorial is a good starting point: Step-By-Step – Creating a custom model with Alfresco.

dotCMIS doesn’t provide built-in support for Alfresco aspects. But there is a way to do that manually by creating extended CMIS elements.


The customModel.xml file contains the model for our example project. Our custom model considers the following aspects:

  • Constraints
  • Aspects
  • Types


In the constraints section, we define a list of currency values that are valid for the attributes.


Aspects are a feature of Alfresco and could be understood as global attribute sets. Apsects can be added and removed for each object in Alfresco. Aspects can be defined on folder or document level.

In our example, the aspects section contains two different aspects. One aspect contains default attributes and the other aspect defines attributes which are used by the content-type “invoice”.


In this section, we define three different node types: Standard, Invoice and Contract. The node type “standard” is as well the base type for invoices and contracts, which means, invoices and contracts inherit all attributes defined by “standard”.

Here is our custum model:


After setting up Alfresco with our new custom model, we’re ready to implement the required code in .NET.  These are the classes we need to add new documents to Alfresco’s document storage via CMIS with dotCMIS. dotCMIS can be downloaded directly from Apache Chemistry project web site.