Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Oct 2002
    Location
    Houston, Texas, USA
    Posts
    303
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Capture Computer ID - Forms (MS Outlook 2000)

    I am creating a form and I need to know which computer the form request comes from so I need to capture the ComputerID. I also want to capture the UserID from the loging. I don't want them to type in their name. Not sure how to enter this in the vb script.

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Capture Computer ID - Forms (MS Outlook 2000)

    The easiest way, if IS always sets these parameters per machine in your entity, is to get them from the environment space:

    strUserID = Environ("username")
    strComputerID = Environ("computername")

    Adjust the environment names as applicable (to see them, at the command line, type SET). (This works in VBA, I assume it'll be fine in VBS).

    If this doesn't work, there are API ways to get UserID, search the VBA forum, not sure about ComputerID.
    -John ... I float in liquid gardens
    UTC -7ąDS

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Capture Computer ID - Forms (MS Outlook 2000)

    <P ID="edit" class=small>(Edited by jscher2000 on 29-Apr-04 14:02. On second thought.)</P>In a pure VBScript environment, you'd have to go out to the Windows Script Host for this information. Assuming the Outlook Forms security model lets you do that, see <post#=130373>post 130373</post#> for some sample code.

    Added: Actually, if you can get this information from the Office or Outlook object model instead of Windows Script Host, that might work better. However, I haven't trawled the object browser to see if it's there. Please post whatever solution you end up using, as I suspect others might be interested in the same thing in the future.

  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Capture Computer ID - Forms (MS Outlook 2000)

    Thanks for the VBS script. VBS doesn't let you read the environment space?

    FWIW, Word and Excel have 'Application.Username', but I don't see the Property in Outlook.
    -John ... I float in liquid gardens
    UTC -7ąDS

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Capture Computer ID - Forms (MS Outlook 2000)

    VBS doesn't have much intelligence about the system without invoking other objects. There is a way to access the environment through the Shell, but I haven't tried to code it up. This page gives an overview of the WSH objects and collections, which can be scripted: Windows Script Host Object Model.

  6. #6
    3 Star Lounger
    Join Date
    Oct 2002
    Location
    Houston, Texas, USA
    Posts
    303
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Capture Computer ID - Forms (MS Outlook 2000)

    Thanks for the examples. I will try these out and see what I come up with.

  7. #7
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Capture Computer ID - Forms (MS Outlook 2000)

    Resurrecting this older thread, I guess I didn't look far enough for the Outlook User; it's a Property of NameSpace:

    Function GetCurrentUser() As String
    Dim objOLApp As Outlook.Application
    Dim nsNS As NameSpace
    Set objOLApp = CreateObject("Outlook.Application")
    Set nsNS = objOLApp.GetNamespace("MAPI")
    GetCurrentUser = vbNullString
    On Error Resume Next
    GetCurrentUser = nsNS.CurrentUser.Name
    Set objOLApp = Nothing
    Set nsNS = Nothing
    End Function
    -John ... I float in liquid gardens
    UTC -7ąDS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •