BusinessObjects Board

Uploading Agnostic Documents via VB Application

You can send it to me. I’ll see that it gets taken care of.


Steve Krandel :us: (BOB member since 2002-06-25)

What is an agnostic document?


dirmiger :us: (BOB member since 2002-08-28)

It is BusinessObjects term for any non-BusinessObjects document loaded into the repository. For example, if proper permissions are granted, Webi users can store XLS, PPT, DOC, or other file types as personal or corporate documents. Since these are not BusinessObjects documents (WID, WQY, REP) they are called “agnostic” documents. :wink:


Dave Rathbun :us: (BOB member since 2002-06-06)

I believe any file that is not a Business Objects file (Business Objects document *.rep, WebI document *.wqy or *.wid, or Business Query document *.bqy) is considered an agnostic file.


Andreas :de: (BOB member since 2002-06-20)

Steve,

What happened to the code I sent to you ? If you are having trouble posting it in the Downloads area, I can just post it here.

Let me know.

Mohan


Mohan :us: (BOB member since 2002-08-15)

This topic contains instructions on how to submit something to BOB’s Downloads area. 8)


Dave Rathbun :us: (BOB member since 2002-06-06)

Here is the code for anyone interested.

'
' Sample working code to automate Uploading Agnostic Documents
' Author: P. S. Mohan (poluvan_mohan@hotmail.com)
'
' This code must run on the WEBI server machine ( Cluster Manager or Node )
'
' Include WebIntelligence 6.0 Object Model (wicom250.dll)
'
Option Explicit

Private Sub Form_Load()
' WEBI variables
    Dim wiserv As WIServer
    Dim wisess As WISession
    Dim wicont As WIObjectContext
    Dim widoc As WIDocument
    
' Binary contents variable
    Dim vTemp As Variant
    Dim rawData As Variant
    Dim retval As Variant
    
' Miscellaneous variables
    Dim sfile As String
    Dim FileLength As Long
    Dim FileNo As Long
    Dim aBytes() As Byte
    Dim ii As Integer
    
' Create the webi server
    Set wiserv = CreateObject("Webi.Server")
    If wiserv.IsRunning = False Then
        MsgBox " *** ERROR *** WEBI Server may not be running."
        End
    End If
    
' Create the webi session

' ***
' ***  specify the userid & password here
' ***
    Set wisess = wiserv.OpenSession("BOUSERID", "BOPASSWORD")
    
    If wisess.UserProfile.Count = 0 Then
        MsgBox " *** ERROR *** Unable to create WEBI session "
        End
    End If
    
' Create a document context
    Set wicont = wisess.CreateContext()
    
' Read the file as binary.

' ***
' *** specify the file name here
' ***
    sfile = "TESTFILE.PDF"
    
    FileNo = FreeFile()
    On Error GoTo ReadBinaryError
    Open sfile For Binary Access Read As #FileNo
    FileLength = FileLen(sfile)
    ReDim aBytes(FileLength)
    Get #FileNo, , aBytes
    Close #FileNo
    rawData = aBytes
    GoTo Exit_ReadBinary
    
ReadBinaryError:
    On Error GoTo 0
    MsgBox "ReadBinaryFile ERROR reading binary file"
    End

Exit_ReadBinary:
    On Error GoTo 0
        
' Create a new document
    Set widoc = wicont.NewDocument()
    
' Set the binary contents of the document
    
' ***
' *** specify the filename and ext here
' ***
    Call widoc.SetBinaryContent(rawData, "TESTFILE", "PDF")
'
    retval = widoc.Upload("this parameter means nothing")
    
    widoc.Comments = "SPECIFY THE DOCUMENT COMMENTS HERE"
    widoc.Keywords = "SPECIFY THE DOCUMENT KEYWORDS HERE"
    widoc.RefreshOnOpen = False ' You do not want to refresh Agnostic docs on open
        
    ' detach all categories first ( This is needed if you are re-uploading )
    vTemp = widoc.CategoryList
    If UBound(vTemp) > 0 Then
        For ii = 0 To UBound(vTemp)
            widoc.DetachCategory (vTemp(ii))
        Next ii
    End If

' ***
' *** specify all the categories here
' ***
    widoc.AttachCategory ("CATEGORY1")
    widoc.AttachCategory ("CATEGORY1/SUB-CATEGORY2")

' Now Publish the document
' ***
' *** parameters are document_title, document_domain, overwrite, group_list
' ***
    retval = widoc.Publish("TITLE OF DOCUMENT", "Document", True, "GROUP1; GROUP2")

    ' do all the cleanup
    Set widoc = Nothing
    Set wicont = Nothing
    wisess.Close
    Set wisess = Nothing
    Set wiserv = Nothing
End Sub

Mohan :us: (BOB member since 2002-08-15)

This is great stuff, thanks for posting!

One question: I have this vb in a report that I will send to the BCA for it to be run once a week. Is it possible to avoid hardcoding the user name and password? Possibly by passing through the username and password that is used to send the doc to the BCA?


bcogden (BOB member since 2004-05-18)

Hello All,

How are you ? I am new member of this forum and have an experience of almost 2 years in Business Objects. So far I have had an opportunity to play with BO SDK (VBA) but never with Webi SDK.

Recently my company came with the requirement to Publish Agnostic Documents to Repository. As per the documentation I have gone through here, I will either need ASP/JSP coding to do this. I have never used ASP/JSP programming.

  1. I will appreciate if someone could tell me where exaclty do you write ASP (Since we have IIS) code ? I mean for VBA we have Macro in Full client but how do we write ASP code in Webi as we are only using Browser?

  2. Do we need to download certain API from Business Objects for WICOM model? If so, do we need to have license for that or it is free if you have webI Licenses? Also, where do we get this WICOM API’s from ?

So basically , I wanted to know for Publishing Agnostic Document in CORP Docs what all I need in terms of WebI SDK , so I can brief my Manager on this.

Please pardon me for trivialness of the questions. I will appreciate if someone could please help me on this.

Merry Christmas,
Sam


samshaw :us: (BOB member since 2004-12-21)

Before writing ASP code, having a look at “ASP Document Viewer Sample” in Developer Suite should help you.

And with WICOM you do NOT have to use ASP unless you are writing a web application. You can reference WICOM from a VB / VBA application as well (as demonstrated in attached code).


shamit (BOB member since 2004-07-01)

Hello Samit,

How are you ? Thanks so much for your prompt reply. I will highly appreciate your help on the folowings:

  1. If I am to Publish Agnostic Document as recommended by MOHAN in his article , Do I need the Developer suite for this or only Full client SDK (VBA) will suffice the needs? Also I will not need any WICOM API’s right? All I need to do is to REFERENCE the Webi 6.5 Object MOdel / Webi 6.0 Object Model in FC SDK…right ???

  2. How do you get the Developer Suite ? Is it free or you need to buy license for this ? Or you get it free if you have Webi Licenses?

  3. If I have the Developer Suite do I automatically get the WICOM API’s or I still will have to Download them?

Take care,
Sam


samshaw :us: (BOB member since 2004-12-21)

You will need WICOM API. Full Client can not publish or retrieve agnostic documents.

Webi 6.5 Object Model is THE WICOM. You can reference WICOM from ASP/ActivePerl/VC++/VB/VBA (Including FC VBA) but you do need WICOM.

It used to be a separate purchase, it seems that it is now available with BO. But you should contact your BO rep for a definit answer.

You get WICOM API docs with Dev Suite. It contains instructions for deploying related DLLs.

HTH


shamit (BOB member since 2004-07-01)

Did this ever make it to BOB’s downloads?


Eileen King :us: (BOB member since 2002-07-10)

I’m not sure that it made it into the BOB downloads.
However, I gave this as a presentation at the 2004 IUC at Grapevine. There should be downloads available from the BO site.


Mohan :us: (BOB member since 2002-08-15)

I got it from there…I’m just trying to figure out how to make it work (if I can…) and trying to understand how to put it into use. If it had been uploaded to BOB I was hoping that there would be a discussion…and I could get a clue! :crazy_face:


Eileen King :us: (BOB member since 2002-07-10)

Eileen,

Did you get any momentum on this!!!

Thanks


Universe :us: (BOB member since 2002-11-11)

I have tried to implement the solution and it is not working for some weird reason. I don’t suppose anybody has run into any trouble using the code on 6.5.2? We are also using a JSP version of Webi.

When testing the code it creates the webi server object and detects it is running and does everything else up to and including creating the widocument object. However, I do not see the category attaching under the category list. Also, when setting the binary content, nothing under that property is changed but the document size property does change. I get a return value of -1 when using the upload method and a return value of 1 when using the publish method. The object model description of those methods is limited. I am not getting any error messages.


chaseclark (BOB member since 2002-10-28)

The problem was with the Publish method. I was using the Title property for the document name, which was blank. No error was being thrown. Anyway, it should have a return value of 0.

Another thing I ran into - when using a capital extension type (using SetBinaryContent), such as PDF, Infoview will not associate it to an acrobat document. You must use lower case, such as pdf.


chaseclark (BOB member since 2002-10-28)

Anybody try this with XI R2?


chaseclark (BOB member since 2002-10-28)

I’m curious…is there any way to implement this running on a machine that is not the WebI server…i.e. remotely connecting to a WebI server through the SDK/VB code?

Any thoughts are appreciated.

Cheers,
Methos


Methos :it: (BOB member since 2003-08-25)