Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

pando (TechnicalUser)
23 Jun 03 0:47
hi,

Is there anyone who can provide me a sample in LAPI using VB.NET?

I have tried LAPI in VB6 but find it hard to use it VB.Net.

Thanks,

ggriffit (Programmer)
23 Jun 03 13:38
Have you looked at WebServices instead of LAPI to work with .Net ?
ohmyigod (Programmer)
24 Jun 03 20:21
Below I've pasted the sample from Livelink SDK's LAPI Help.
The code is written in C#. check it out.(I haven't tested it)

ggriffit, what webservices are you talking about?? can u please provide more information on livelink webservices??

using System;

using com.opentext.api;  
   
   namespace AddDeleteDocument
{
   class AddDeleteDocument
   {
      [STAThread]
      static void Main(string[] args)
      {  
   
           try
         {  
   
            LLSession session = null;
            LAPI_DOCUMENTS documents = null;

            int status = 0;
            int nodeID = 0;
            int parentID = 0;
            int nodeVol = 0;
            int parentVol = 0;

            LLValue pwsInfo = ( new LLValue() ).setAssocNotSet();
            LLValue objInfo = ( new LLValue() ).setAssocNotSet();
            LLValue versionInfo = ( new LLValue() ).setAssocNotSet();  
   
            // Instantiate session object
            session = new LLSession( server, port, "",
                                     Livelink_UID, UID_pw, null );

            // Instantiate documents object
            documents = new LAPI_DOCUMENTS( session );  
   
            // Access the user's Personal Workspace
            status = documents.AccessPersonalWS( pwsInfo );

            if ( status == 0 )
            {
               Console.WriteLine( "Accessed Personal Workspace" );
               parentVol = pwsInfo.toInteger( "VolumeID" );
               parentID = pwsInfo.toInteger( "ID" );
            }  
   
               if ( status == 0 )
            {
               // Add document
               status = documents.AddDocument( parentVol, parentID,
                           title, file,
                           objInfo, versionInfo );

               if ( status == 0 )
               {
                  Console.WriteLine( "Added document" );

                  nodeVol = objInfo.toInteger( "VolumeID" );
                  nodeID = objInfo.toInteger( "ID" );
               }
            }  
   
               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 ) + ")" );

                  if ( message != "" || errMsg != "" || apiError != "" )
                  {
                     Console.WriteLine( "Message=" + message );
                     Console.WriteLine( "errMsg=" + errMsg );
                     Console.WriteLine( "apiError=" + apiError );
                  }
               }
            }  
 
   
              Console.WriteLine( "End of sample" );
         }  
   
           catch ( Exception e )
         {
            // Display exception
            Console.WriteLine( "Application encountered an exception:" );
            Console.WriteLine( e.Message );
            Console.WriteLine( e.StackTrace );
         }  
   
         }
   }
}  
pando (TechnicalUser)
24 Jun 03 23:43
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

    End Sub
End Class
ggriffit (Programmer)
25 Jun 03 9:06
More info on WebServices & Livelink at :

Thread862-578138

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close