Any help on this topic is really apprecaiated.
I’m tryuing to build the following.
Connections --> Corrsponding Universes --> Corresponding Groups --> Users in the Group --> Folders --> Reports in the folder.
So far, I was able to create the following
- Groups and users wihin the group
2.Connection and corresponding universes.
Now I need to link Universes and its corresponding Groups, so that I can combine the above two.
Any assistance is really appreciaetd.
Code for Group to User Mapping
Private Sub CommandButton1_Click()
Sheets("GrpUsers").Range("A5:L65000").ClearContents
'Session Manager declaration
'Updated 01/14/2013, added all references for BI4 assemblies, Ferdie_CienD.
Dim SessionManager, Sess As SessionMgr
'Enterprise Session declaration
Dim esession As EnterpriseSession
'InfoStore declaration
Dim iStore As InfoStore
'Info Objects declaration
Dim Users, Groups As InfoObjects
'Info Object declaration
Dim UserItem, GroupItem As InfoObject
'User Object declaration
Dim GroupObject As UserGroup
Dim UserObject As User
' new code
Dim Rng As Excel.Range
Dim RowNum, GroupNum As Long
Dim SIName As String
'Session Manager instanciation
Set SessionManager = CreateObject("CrystalEnterprise.SessionMgr")
'Enterprise Session instanciation
Set esession = SessionManager.Logon("Administrator", "Password", "CMS", "secEnterprise")
'Infostore instanciation
Set iStore = esession.Service("", "InfoStore")
Set Groups = iStore.Query("SELECT SI_ID, SI_NAME FROM CI_SYSTEMOBJECTS Where SI_KIND='UserGroup' order by SI_NAME")
RowNum = 4
Set Rng = Sheets("GrpUsers").Cells
For Each UserItem In Groups
Set GroupObject = UserItem
RowNum = RowNum + 1
Rng(RowNum, 3) = GroupObject.Properties("SI_NAME")
SIName = GroupObject.Properties("SI_NAME")
Set Users = iStore.Query("SELECT SI_NAME,SI_KIND, SI_USERFULLNAME FROM ci_systemobjects WHERE descendants(""si_name='Usergroup-User'"", ""si_name ='" & SIName & "'"") AND SI_KIND='User' ")
For Each GroupItem In Users
Set UserObject = GroupItem
RowNum = RowNum + 1
Rng(RowNum, 4) = UserObject.Properties("SI_NAME")
'Rng(RowNum, 5) = UserObject.Properties("SI_KIND")
Rng(RowNum, 5) = UserObject.Properties("SI_USERFULLNAME")
Next GroupItem
Next UserItem
End Sub
Code for Connection to Universe Mapping
Private Sub CommandButton1_Click()
Sheets("UnvConn").Range("A5:L65000").ClearContents
'Session Manager declaration
'Updated 01/14/2013, added all references for BI4 assemblies, Ferdie_CienD.
Dim SessionManager, Sess As SessionMgr
'Enterprise Session declaration
Dim esession As EnterpriseSession
'InfoStore declaration
Dim iStore As InfoStore
'Info Objects declaration
Dim Users, Groups, Folders, Conn, UnvConn As InfoObjects
Dim oConn As InfoObject
'Info Object declaration
Dim UserItem, GroupItem, FolderItem, ConnItem, UnvConnItem As InfoObject
'User Object declaration
Dim GroupObject As UserGroup
Dim UserObject As User
Dim UnvObject As Universe
Dim FolderObject As Folder
Dim ConnObject As Object
Dim UnvConnObject As Object
' new code
Dim Rng As Excel.Range
Dim RowNum, GroupNum As Long
Dim SIName As String
Dim connSIID As String
'Session Manager instanciation
Set SessionManager = CreateObject("CrystalEnterprise.SessionMgr")
'Enterprise Session instanciation
Set esession = SessionManager.Logon("Administrator", "Password", "CMS", "secEnterprise")
'Infostore instanciation
Set iStore = esession.Service("", "InfoStore")
' Query to get the connections
Set Conn = iStore.Query(" SELECT SI_ID,SI_NAME,SI_Description FROM ci_appobjects where SI_KIND in ('CCIS.DataConnection')")
RowNum = 4
Set Rng = Sheets("UnvConn").Cells
For Each ConnItem In Conn
Set ConnObject = ConnItem
RowNum = RowNum + 1
Rng(RowNum, 2) = ConnObject.Properties("SI_NAME")
Rng(RowNum, 3) = ConnObject.Properties("SI_ID")
Rng(RowNum, 4) = ConnObject.Properties("SI_DESCRIPTION")
connSIID = ConnObject.Properties("SI_ID")
SIName = ConnObject.Properties("SI_NAME")
Set UnvConn = iStore.Query("SELECT SI_ID, SI_NAME, SI_OWNER FROM CI_APPOBJECTS WHERE descendants(""si_name='DATACONNECTION-UNIVERSE'"", ""si_id ='" & connSIID & "'"") ")
For Each UnvConnItem In UnvConn
Set UnvConnObject = UnvConnItem
RowNum = RowNum + 1
Rng(RowNum, 5) = UnvConnObject.Properties("SI_NAME")
SIName = UnvConnObject.Properties("SI_NAME")
Next UnvConnItem
Next ConnItem
End Sub
308002184 (BOB member since 2017-08-09)