Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I export users from Access Man. to text file ? 3

Status
Not open for further replies.

Recce

Programmer
Aug 28, 2002
425
ZA
Good day,

I'd like to know how do I export my user list from Access Manager to a text file ? :)
 
Recce,
This macro is available from the Cognos Website (KB) and works a treat. Alterations required if you want a .csv instead.
lex
----------------------------------------------------------

Option Explicit

Sub Get_Users_List(UserClass As Object)

Dim I As Integer

If UserClass.Users.Count > 0 Then
For I = 1 To UserClass.Users.Count
Print #1, UserClass.Name, UserClass.Users(I).Name
Next
else
Print #1, UserClass.Name & ":"
End If

If UserClass.UserClasses.Count >= 0 Then
For I = 1 To UserClass.UserClasses.Count
Call Get_Users_List(UserClass.UserClasses(I))
Next
End If

End Sub

Sub Main()

Dim objAuthApp As Object ' Access Manager Application Object
Dim objAuthDoc As Object ' Access Manager Document Object
Dim objDSConfig As Object

Const AdminUser = "Administrator"
Const AdminSignon = ""
Const NameSpace = "default"
Const FileName = "C:\ClassUsers.txt"

' Calls Access Manager and opens namespace with admin signon
Set objAuthApp = CreateObject("Authenticator2.Application")
Set objAuthDoc = objAuthApp.Documents.OpenWithBasicSignon(NameSpace, AdminUser, AdminSignon, 0)

' Opens output file and writes title
Open FileName For Output As #1
Print #1, "User Class:User Name"

' Calls recursive procedure for getting users list
Call Get_Users_List(objAuthDoc.RootUserClass)

' Closes output file
Close #1

' Exits Access Manager
objAuthApp.Quit
Set objAuthDoc = Nothing
Set objAuthApp = Nothing

End Sub

"Time flies like an arrow, but fruit flies like a banana."
 
Thanks for this drlex. I will use the macro. :)
 
Hi,

I've got this macro working for my users, however, how would you go about extracting the BasicSignon id for each user as well? I've taken a quick look at the help file but can't get it to work.

J
 
I'm not sure this is possible; it would appear to be add or delete only, as use of the objUser.IdentificationInformation.BasicSignons command gives a R440 "AccessAdmAuto:Unable to read write-only property."

soi la, soi carre
 
This is what I used to print out user information to a file.

Set objUser = objAuthDoc.UserFolder.Users(x)
Print #1, objUser.LastName & ", " & objUser.FirstName & ", " & objUser.EmailAddress & ", " & objUser.IdentificationInformation.BasicSignons.item(1).name

Of course, this is all one line in my code, but the important part is

objUser.IdentificationInformation.BasicSignons.item(1).name
 
flex13
You're right - I was trying to get the passwords.
Do you have a script that can extract the contents of folders within the userfolder?
lex

soi la, soi carre
 
There is a sample application that I wrote called Access Reported (available on the Cognos support site). It has all the necessary source code (VB) that shows how to do the recursive calls. IF you can't find it or don't have access, let me know.
 
flex,
Have D/L'd it from the site, thanks. The problem I have is that it is configured for cer2 installation, not cer3. I lack the tools to correct the .exe (or recompile from vba), but it looks good from the manual!
Let me know if an updated version becomes available.
regards,
lex

soi la, soi carre
 
There should also be a version for cer3 available. If it is not, I'll have to make sure that it gets replaced. In the meantime, you can modify the code (think it was a one or two line change as it performs a registry lookup).
 
Thanks; it is there - my oversight in picking the wrong one. I hope Cognos showed its gratitude for a neat piece of coding!
lex

soi la, soi carre
 
Well, let's just say that I'm on the payroll. ;)

Glad you liked the application.
 
Guys, here's the next part of the challenge.

Some of the users have an OS Signon, some have a BasicSignon, and some have both. I want to extract both of these userIDs into the text file.

The macro I've edited would work if the user currently has both of these set, but doesnt work when both of these values are not set. (I'm getting a macro error saying "Object value is set to nothing")

I want to add 2 if statements and 2 variables to check if the value is present and if not use "<none>", but I can't figure out what syntax I need to have in the IF condition.

ie. I've declared the var "BasicSignonValue", and the If statement will be something like:
[blue]
If (UserList(I).IdentificationInformation.BasicSignons.item(1).Name = ???) Then
BasicSignonValue = "<none>"
Else
BasicSignonValue = UserList(I).IdentificationInformation.BasicSignons.item(1).Name
End If[/blue]

What value/function do I need to be performing in the If condition to get the macro to work correctly? I would have thought I'd use [blue]If UserList(I).IdentificationInformation.BasicSignons.item(1).Name is Nothing Then ...[/blue] or [blue] If IsNull(UserList(I).IdentificationInformation.BasicSignons.item(1).Name) Then ...[/blue] but they don't work.

J
 
Use the Count property.

If (UserList(I).IdentificationInformation.BasicSignons.Count = 0 Then
BasicSignonValue = "<none>"
Else
BasicSignonValue = UserList(I).IdentificationInformation.BasicSignons.item(1).Name
End If

Same thing for OS_Signon

Pain is stress leaving the body.

DoubleD [bigcheeks]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top