BOB: Business Objects Board
Not endorsed by or affiliated with SAP

Register | Login 

Want to sponsor BOB? 
Want to sponsor BOB? (Opens a new window)  

General Notice: No events within the next 45 days.

Retrieve information from the BI 4.x InfoStore with VB .NET


 
Search this topic... | Search SDK (VBA/ASP/JSP)... | Search Box
Register or Login to Post    Forum Index -> SDK (VBA/ASP/JSP)  Previous TopicPrint TopicNext Topic
Author Message
Lyb
Forum Member
Forum Member



Joined: 25 Sep 2019

Posts: 2
Location: Bordeaux


flag
PostPosted: Wed Sep 25, 2019 9:01 am 
Post subject: Retrieve information from the BI 4.x InfoStore with VB .NET

Hi,
I have a program written in Visual Basic 6 in order to read from the BI 4.x InfoStore, that has been working perfectly for years.
I am desesperately trying to rewrite it in VB .NET, but I can't make it work.

Here is a sample code:

Code:

Sub Main()

  Dim oBoSessionManager As CrystalEnterpriseLib.SessionMgr
  Dim oBoSession As CrystalEnterpriseLib.EnterpriseSession
  Dim oBoInfostore As CrystalInfoStoreLib.InfoStore
  Dim sReqUti As String
  Dim oResUti As Object
  Dim oUti As Object
  Dim sUtiid As String
  Dim sCuid As String
  Dim sUtilisateur As String
  Dim sNomLong As String


  'En cas d'erreur aller au (non-)traitement de l'erreur (!)
  On Error GoTo Erreur

  'Connexion au référentiel de BO
  oBoSessionManager = CreateObject("CrystalEnterprise.SessionMgr")
  oBoSession = oBoSessionManager.Logon(My.Settings.BoUtilisateur, My.Settings.BoMotdepasse, My.Settings.BoSysteme, My.Settings.BoAuthentification)
  oBoInfostore = oBoSession.Service("", "InfoStore")

  'Liste des utilisateurs
  sReqUti = "SELECT TOP 1000000 SI_ID, SI_CUID, SI_NAME, SI_USERFULLNAME, SI_CUSTOM_MAPPED_ATTRIBUTES, SI_EMAIL_ADDRESS, SI_NAMEDUSER, SI_ALIASES, SI_CREATION_TIME, SI_UPDATE_TS, SI_LASTLOGONTIME"
  sReqUti = sReqUti & " FROM CI_SYSTEMOBJECTS WHERE SI_KIND IN (" & sKindUtilisateurs & ") ORDER BY SI_NAME"
  Set oResUti = oBoInfostore.Query(sReqUti)
 
  For Each oUti In oResUti
    'Initialisation à vide des propriétés facultatives
    sNom = ""
    sPrenom = ""
    sInfos = ""
    sDateDCnx = ""
   
    sUtiid = CStr(oUti.Properties("SI_ID"))
    sCuid = Replace(oUti.Properties("SI_CUID"), "'", "''")
    sUtilisateur = Replace(oUti.Properties("SI_NAME"), "'", "''")
    sNomLong = Replace(oUti.Properties("SI_USERFULLNAME"), "'", "''")
   
  'Fermeture
  Set oResUti = Nothing
 
  'Sortie pour ne pas passer par l'erreur
  Exit Sub
 
Erreur:

    If Err = -2147210697 Then
        'property not filled or not exists
        Resume Next
    End If
   
    Debug.Print "Problème sur Utilisateur SI_ID = " & sUtiid
    Debug.Print Error(Err)

End Sub


The code works fine until the line:
sUtiid = CStr(oUti.Properties("SI_ID"))

But then all my string variables get the same value: "System.__ComObject"

Could someone help me read the user properties (SI_*) I've selected in my query?

Thanks a lot
Back to top
joepeters
Forum Fanatic
Forum Fanatic



Joined: 29 Aug 2002

Posts: 6626
Location: Connecticut, USA


flag
PostPosted: Thu Sep 26, 2019 1:05 pm 
Post subject: Re: Retrieve information from the BI 4.x InfoStore with VB .

Not certain it will work, but try:

sUtiid = CStr(oUti.Properties("SI_ID").Value)
Back to top
Lyb
Forum Member
Forum Member



Joined: 25 Sep 2019

Posts: 2
Location: Bordeaux


flag
PostPosted: Fri Sep 27, 2019 1:35 am 
Post subject: Re: Retrieve information from the BI 4.x InfoStore with VB .

Yes, it does! icon_biggrin.gif
Thank you so much, joe!
Back to top
joepeters
Forum Fanatic
Forum Fanatic



Joined: 29 Aug 2002

Posts: 6626
Location: Connecticut, USA


flag
PostPosted: Fri Sep 27, 2019 6:29 am 
Post subject: Re: Retrieve information from the BI 4.x InfoStore with VB .

Glad I could help!
Back to top
Display posts from previous:   
Register or Login to Post    Forum Index -> SDK (VBA/ASP/JSP)  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT - 5 Hours
 
Jump to:  

Index | About | FAQ | RAG | Privacy | Search |  Register |  Login 

Get community updates via Twitter:

Not endorsed by or affiliated with SAP
Powered by phpBB © phpBB Group
Generated in 0.0309 seconds using 17 queries. (SQL 0.0030 Parse 0.0009 Other 0.0270)
CCBot/2.0 (https://commoncrawl.org/faq/)
Hosted by ForumTopics.com | Terms of Service
phpBB Customizations by the phpBBDoctor.com
Shameless plug for MomentsOfLight.com Moments of Light Logo