if ( status == 0 )
{
// Delete document
status = documents.DeleteObject( nodeVol, nodeID );
if ( status == 0 )
{
Console.WriteLine( "Deleted document" );
}
}
// Handle any errors
if ( status != 0 )
{
// Display status code in both integer and hex
System.Console.WriteLine( "Status=" + status +
" (0x" + Convert.ToString( status, 16 ) +"" );
// If the session handle is valid, get the session's error
// information
if ( session != null )
{
// Get the error information
int stat = session.getStatus();
string message = session.getStatusMessage();
string errMsg = session.getErrMsg();
string apiError = session.getApiError();
Console.WriteLine( "Session failure status is " + stat +
" (0x" + Convert.ToString( stat ) + "" );
Thank you ohmyigod but I have tried already that example from Lapi Help.
Below is a sample in VB.Net that creates a Livelink user. Can you help me or anyone help me retrieve users list?
Imports com.opentext.api
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents btnConnect As System.Windows.Forms.Button
Friend WithEvents lblStatus As System.Windows.Forms.Label
Friend WithEvents txtPassword As System.Windows.Forms.TextBox
Friend WithEvents txtUserName As System.Windows.Forms.TextBox
Friend WithEvents txtDatabaseName As System.Windows.Forms.TextBox
Friend WithEvents txtPortNo As System.Windows.Forms.TextBox
Friend WithEvents txtServerName As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.btnConnect = New System.Windows.Forms.Button()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.txtPassword = New System.Windows.Forms.TextBox()
Me.txtUserName = New System.Windows.Forms.TextBox()
Me.txtDatabaseName = New System.Windows.Forms.TextBox()
Me.txtPortNo = New System.Windows.Forms.TextBox()
Me.txtServerName = New System.Windows.Forms.TextBox()
Me.Label5 = New System.Windows.Forms.Label()
Me.Label4 = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label1 = New System.Windows.Forms.Label()
Me.lblStatus = New System.Windows.Forms.Label()
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'btnConnect
'
Me.btnConnect.Location = New System.Drawing.Point(328, 16)
Me.btnConnect.Name = "btnConnect"
Me.btnConnect.Size = New System.Drawing.Size(75, 24)
Me.btnConnect.TabIndex = 0
Me.btnConnect.Text = "Connect"
'
'GroupBox1
'
Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.txtPassword, Me.txtUserName, Me.txtDatabaseName, Me.txtPortNo, Me.txtServerName, Me.Label5, Me.Label4, Me.Label3, Me.Label2, Me.Label1})
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(312, 184)
Me.GroupBox1.TabIndex = 1
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "GroupBox1"
'
'txtPassword
'
Me.txtPassword.Location = New System.Drawing.Point(112, 152)
Me.txtPassword.Name = "txtPassword"
Me.txtPassword.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.txtPassword.TabIndex = 9
Me.txtPassword.Text = "lando"
'
'txtUserName
'
Me.txtUserName.Location = New System.Drawing.Point(112, 120)
Me.txtUserName.Name = "txtUserName"
Me.txtUserName.TabIndex = 8
Me.txtUserName.Text = "lando"
'
'txtDatabaseName
'
Me.txtDatabaseName.Location = New System.Drawing.Point(112, 88)
Me.txtDatabaseName.Name = "txtDatabaseName"
Me.txtDatabaseName.Size = New System.Drawing.Size(192, 20)
Me.txtDatabaseName.TabIndex = 7
Me.txtDatabaseName.Text = "Livelink"
'
'txtPortNo
'
Me.txtPortNo.Location = New System.Drawing.Point(112, 56)
Me.txtPortNo.Name = "txtPortNo"
Me.txtPortNo.Size = New System.Drawing.Size(56, 20)
Me.txtPortNo.TabIndex = 6
Me.txtPortNo.Text = "2099"
'
'txtServerName
'
Me.txtServerName.Location = New System.Drawing.Point(112, 24)
Me.txtServerName.Name = "txtServerName"
Me.txtServerName.Size = New System.Drawing.Size(192, 20)
Me.txtServerName.TabIndex = 5
Me.txtServerName.Text = "landz"
'
'Label5
'
Me.Label5.Location = New System.Drawing.Point(8, 152)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(56, 16)
Me.Label5.TabIndex = 4
Me.Label5.Text = "Password"
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(8, 120)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(64, 16)
Me.Label4.TabIndex = 3
Me.Label4.Text = "Username"
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(8, 88)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(100, 16)
Me.Label3.TabIndex = 2
Me.Label3.Text = "Database Name"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(8, 56)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(48, 16)
Me.Label2.TabIndex = 1
Me.Label2.Text = "Port No"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(8, 24)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(72, 24)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Server Name"
'
'lblStatus
'
Me.lblStatus.Location = New System.Drawing.Point(0, 192)
Me.lblStatus.Name = "lblStatus"
Me.lblStatus.Size = New System.Drawing.Size(312, 16)
Me.lblStatus.TabIndex = 2
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(416, 213)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.lblStatus, Me.GroupBox1, Me.btnConnect})
Me.MaximizeBox = False
Me.Name = "Form1"
Me.Text = "LAPI Test"
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub btnConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConnect.Click
Dim session As LLSession
Dim users As LAPI_USERS
Dim userlist As LLValue
Dim userdata As LLValue
Dim userAttributes As LLValue
Dim ID As LLValue
Dim status As Long
Dim stat As Long
Dim message As String
Dim errMsg As String
Dim apiError As String
session = New LLSession(txtServerName.Text, txtPortNo.Text, txtDatabaseName.Text, txtUserName.Text, txtPassword.Text)
users = New LAPI_USERS(session)
userlist = New LLValue().setAssocNotSet
ID = New LLValue().setAssocNotSet
status = users.ListUsers(userlist)
If (status = 0) Then
Console.WriteLine("users listed!!!"
End If
userAttributes = New LLValue().setAssocNotSet
status = users.CreateUser("Pando", "mypassword", 0, userdata, 1, "DefaultGroup", userAttributes, ID)
stat = session.getStatus
message = session.getStatusMessage
errMsg = session.getErrMsg
apiError = session.getApiError
Console.WriteLine("Session failure status is " + stat.ToString + " (0x" + stat.ToString)
If (message <> "" And (errMsg <> "" And (apiError <> "" Then
Console.WriteLine("Message=" + message)
Console.WriteLine("errMsg=" + errMsg)
Console.WriteLine("apiError=" + apiError)
End If
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.