.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.

CLASS “CONSTANTS.CS”

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#:

 

CLASS “USER.CS”

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.

CLASS “USERSERVICES.CS”

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.

Snippet

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

 

Tags: , ,

HINTERLASSE EINEN KOMMENTAR

lädt
×