Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Content Management (Extended ECM)
API, SDK, REST and Web Services
Adding Users using LAPI
Anuradha_Deo_(PATCOM01User2_(Delete)_2735478)
can anyone send me a code to add Users along with access permissions into Livelink using LAPI.This is urgent.Thanks in advance
Find more posts tagged with
Comments
***_****_(citlon01admin_-_(deleted))
Sorry this is quick and simple. It loads users from a text file list.Private Sub Command1_Click() ' Declare some constants for the user and group to add ' In production, your code would read a file where this information is stored. Dim USER_NAME As String USER_NAME = "dloffhag" Dim USER_PASS As String USER_PASS = "" Dim USER_FIRST As String USER_FIRST = "David" Dim USER_LAST As String USER_LAST = "Loffhagen" Dim USER_GROUP As String USER_GROUP = "LL Internal Public Group" 'USER_GROUP = "DefaultGroup" Dim USER_MAILADDRESS As String USER_MAILADDRESS = USER_NAME & "
@city
.london.on.ca" 'Dim USER_TITLE As String ' USER_TITLE = "Title of user" 'Dim USER_PHONE As String ' USER_PHONE = "661-5825" Dim session As Long Dim status As Long Dim lstatus As Long Dim ID As Long Dim row As Long Dim UserData As Long Dim intAdded As Integer Dim intDuplicate As Integer Dim USER_DEPT As String status = LL_SessionAllocEx(session, "docs", 2099, "", "Admin", "password", 0) If checkstatus(session, status) = False Then Exit Sub Else Open "C:\Documents and Settings\dloffhag\Desktop\Working Documents\Second User List.csv" For Input As #1 Do While Not EOF(1) DoEvents Dim strStatus As String Dim strPhone As String Input #1, USER_NAME, USER_FIRST, USER_LAST, USER_DEPT, USER_MAILADDRESS USER_NAME = LCase(USER_NAME) ' USER_FIRST = Left(USER_FIRST, 1) & LCase(Right(USER_FIRST, Len(USER_FIRST) - 1)) ' USER_LAST = Left(USER_LAST, 1) & LCase(Right(USER_LAST, Len(USER_LAST) - 1)) USER_MAILADDRESS = LCase(USER_NAME) & "
@city
.london.on.ca" status = LL_ValueAlloc(UserData) status = LL_ValueSetAssocInArgs(UserData) If checkstatus(session, status) = False Then Exit Sub End If status = LL_ValueAlloc(row) status = LL_ValueSetAssoc(row) If checkstatus(session, status) = False Then Exit Sub End If ' There are more fields in row than these. status = LL_AssocSetString(row, "FirstName", USER_FIRST) status = LL_AssocSetString(row, "LastName", USER_LAST) status = LL_AssocSetString(row, "MailAddress", USER_MAILADDRESS) 'status = LL_AssocSetString(row, "Title", USER_TITLE) 'status = LL_AssocSetString(row, "Contact", USER_PHONE) ' Create the user if you can. ' You may wish to call the GetUserInfo() method to test for the ' existence of this user before creating. CreateUser() will fail ' if the user already exists. lstatus = LL_CreateUser(session, LCase(USER_NAME), USER_PASS, _ LL_PRIV_LOGIN Or LL_PRIV_UAPI_SESSION Or _ LL_PRIV_DAPI_SESSION Or LL_PRIV_WAPI_SESSION Or LL_PRIV_PERM_WORLD, _ UserData, LL_GROUP, USER_GROUP, row, ID) 'If checkstatus(session, status) = False Then If lstatus = 0 Then 'LL_SessionFree (session) 'LL_ValueFree (UserData) 'Exit Sub 'Stop 'MsgBox "Duplicate user" & USER_NAME intAdded = intAdded + 1 Else 'MsgBox ("User added successfully.") intDuplicate = intDuplicate + 1 End If 'LL_SessionFree (session) LL_ValueFree (UserData) LL_ValueFree (row) Loop MsgBox "DONE" MsgBox "Number added " & intAdded MsgBox "Number duplicate " & intDuplicate Close End If LL_SessionFree (session) End Sub
unknown_Support_user
When i use this code LL_CreateUser returns a 400404 code and no user is added (it always returns 400404), anyone got a clue about this?note: i noticed there is another old topic about the 400404 return code of createuser, but no sollution to the problem.