• Creator
    Topic
  • #4106
    jyeomans
    Participant

      Hi,

      Is it possible to retrieve the currently logged on users details from the eDirectory.

      If so, could anyone provide an example?

      Thanks

    • Author
      Replies
    • #7120
      Support 1a
      Participant

        Yes, this is possible using Novell NDS ActiveX controls. You can download these from Novell.

        Here is a very simple example:

        '-------------------------------------------------------------------------------
        ' Read Novell eDirectory Example
        ' Designed by: Formativ Business Solution Team
        ' Copyright (c) 2002 Advansys Corporation (www.advansyscorp.com)
        ' Version 1.0
        '
        ' Description:
        ' This is an example of reading user phone numbers out of eDirectory using
        ' Formativ.  Before running the example, you must:
        ' 
        ' 1) Download and install the Novell Controls for ActiveX from
        '    www.developer.novell.com/ndk/ocx.htm
        ' 
        ' 2) Edit line "oSession.Fullname =" below, inserting the full path of the tree
        '    and context you wish to browse.
        '
        ' 3) Be authenticated to eDirectory
        ' 
        ' This is a very simple example with no error checking, etc.  It can be easily
        ' extended to use any of the features found in the Novell ActiveX controls, 
        ' including updating field values, etc.
        '
        ' INTEGRATIONS: There are no integrations defined apart from appearing on the
        '               Formativ Applet Run Menu.
        '-------------------------------------------------------------------------------
        
        Sub Main(Client, GWEvent)
        
          Dim oSession
          Dim ServerNames
          Dim Entries
          Dim Entry
          
          ' Create an instance of the NWDir COM object
          Set oSession = CreateObject("NWDirLib.NWDirCtrl.1")
        
          ' Specify the name of the tree "<tree name>" and context "<ou>" you wish to browse
          ' for example, oSession.FullName = "NDS:\<tree name><ou>...<ou> etc."
          oSession.FullName = "NDS:\<tree name><ou>"
            
          ' Display each user and their phone number
          Set Entries = oSession.Entries
          for each Entry in Entries
            if Entry.Layout.Name = "User" then
              PhoneField = Entry.GetFieldValue("Telephone Number", "", True)
              Call MsgBox("User: "& Entry.ShortName & "  Phone Number: " & PhoneField(0),,"Formativ")
            end if  
          next
          
          Set oSession = nothing
        
        End Sub

        I hope this helps.

        Advansys Support

        #7118
        jyeomans
        Participant

          Thanks for the reply. However, im afraid it does not really answer my question.

          This code lists all users. I just need to retreive the details of the person who is currently logged in, not everyone.

          Thanks again.

          #7119
          Support 1
          Participant

            I notice that the URL listed in the source code comment is out-of-date. The necessary ActiveX controls can be downloaded from:

            To answer your question about the current user, try this:

              oSession.FullName = oSession.LoginName

            I hope this helps.

            Advansys Support

          Viewing 3 replies - 1 through 3 (of 3 total)
          • You must be logged in to reply to this topic.