You are viewing limited content. For full access, please sign in.



Automating LFDS user creation with Laserfiche.LicenseManager

posted on May 9 Show version history

This is a VB method I created to add AD accounts as Named Users to the LFDS site:

Imports Laserfiche.LicenseManager

    ''' <span class="code-SummaryComment"><summary>
    ''' Procedure to create a new LF Active Directory User account in LDS Site
    ''' </summary></span>
    ''' <span class="code-SummaryComment"><param name="sLDSServer">Laserfiche Directory Service Server FQDN</param></span>
    ''' <span class="code-SummaryComment"><param name="sRealmName">LFDS Site Name</param></span>
    ''' <span class="code-SummaryComment"><param name="sUserName">AD User name - "Domain\User"</param></span>
    ''' <span class="code-SummaryComment"><param name="sUserSID">AD SID for user - </param></span>
    ''' <span class="code-SummaryComment"><remarks></remarks></span>
    Private Sub AddNamedUserWithFullLicense(ByVal sLDSServer As String, ByVal sRealmName As String, ByVal sUserName As String, ByVal sUserSID As String)
            ' Create a new LDS Server instance
            Using LDSServer As LMO.Server = LMO.Server.Connect(sLDSServer, False)
                ' Load the LFDS Site
                Dim LDB As LMO.Database = LDSServer.GetDatabaseByRealmName(sRealmName)
                ' Log into site using Windows Authentication
                ' Create a new LDS AD User object
                Dim ADUser As LMO.ActiveDirectoryUser = LMO.ActiveDirectoryUser.Create(LDB)
                ' Set Identity Provider property
                ADUser.IdentityProviderID = LMO.IdentityProviderType.ActiveDirectory
                ' Set Name property
                ADUser.Name = sUserName
                ' Set SID property
                ADUser.SIDString = sUserSID
                ' Set Enabled property
                ADUser.Enabled = True
                ' Create a Guid Array for Licensing
                Dim LG(0) As Guid
                ' Add Full license to Guid Array
                LG(0) = LMO.WellKnownLicenseType.Full
                ' Set Licenses property
                ADUser.Licenses = LG
                ' Save the user to LDS
                Dim iResult As Integer = ADUser.Register()
            End Using
        Catch ex As Exception
        End Try
    End Sub


Since we have no documentation yet for Laserfiche.LicenseManager, this was all trial and error.  If anyone else has a better way or more options/info, we look forward to hearing it.


Note: the LicenseManagerObjects.dll is installed as part of LFDS and by default is located at "C:\Program Files\Laserfiche\Directory Server\".  Add it as a reference to your project.

2 0
replied on May 9

As a note, we now have some documentation available on a per-request basis. Please contact your regional manager for more information.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.