Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Levin, Manawatu-Wanganui, New Zealand
    Posts
    324
    Thanks
    9
    Thanked 28 Times in 26 Posts

    Establish the group Name for a Login (Win 2k Server)

    Hi folks
    I would like to establish the group membership of a user login.

    The following code establishes the Username.
    (this was found at www.chrisrae.com)

    I would like something similar for the group membership.
    This will enable me to programmatically set some Word work group template locations by group.
    Cheers
    Geof
    ------------

    Option Explicit
    ' This is used by GetUserName() to find the current user's
    ' name from the API
    Declare Function Get_User_Name Lib "advapi32.dll" Alias _
    "GetUserNameA" (ByVal lpBuffer As String, _
    nSize As Long) As Long
    Function GetUserName() As String
    Dim lpBuff As String * 25

    Get_User_Name lpBuff, 25
    GetUserName = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
    End Function

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Establish the group Name for a Login (Win 2k Server)

    What, if I may ask, *is* a Word workgroup? Does it have any formal structure or membership? I've always assumed the Workgroup Templates file location was simply for shared templates, but I've never tried to make effective use of it.
    Charlotte

  3. #3
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Levin, Manawatu-Wanganui, New Zealand
    Posts
    324
    Thanks
    9
    Thanked 28 Times in 26 Posts

    Re: Establish the group Name for a Login (Win 2k Server)

    Hi Charlotte
    The group I am retrieving is the NT login group(Dept sorry) from their NT Account details.

    I have a need to nail down some Workgroup templates which I am accomplishing with a global template in STARTUP set to a network drive. Amongst other things a script here fixes the location of the workgroup templates. One dept however needs a variation in the work group location in order for some 3rd party s/ware to work,

    hence I thought it might be more efficient to query the login acct dept rather than the username.

    If GetUserDept = "X" then
    .DefaultFilePath(Path:=wdWorkgroupTemplatesPath) = "Fath1"
    else
    .DefaultFilePath(Path:=wdWorkgroupTemplatesPath) = "F:Path2"
    End if
    perhaps a Select Case

    From what I have recently read about ADSI this can be accomplished but I have never dealt with it before.

    Still first time for everything

    Thanks

    Geof

Posting Permissions

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