Monday, March 15, 2010

Business Objects XI R2 List Treeview Reports With Sharepoint

Hello everyone

For some reason, people start to ask me for Business Objects and integration With Sharepoint.

Some time ago, have to makes webpart and Develomp page to integrate with Business Object Reports
here the document i use to help develomp and use the Business Object API on the project "BUSINESS OBJECTS WEBSERVICES INTEGRATION":


//Method to make the connection to Business Objects and filter result in this case "categories, documents and folder"

Credential val = new Credential();
Session boSession = new Session(boConnection);
SessionInfo boSI = boSession.Login(boCredential );
Token = boSI.DefaultToken;
String[] strBOCatURL = boSession.GetAssociatedServicesURL("BICatalog");
boCatalog = BICatalog.GetInstance(boSession, strBOCatURL[0]);
SortType[] mySort = new SortType[1];
mySort[0] = SortType.NAMEASC;
string[] bicatalogObjectType = new string[3];
bicatalogObjectType[0] = "categories";
bicatalogObjectType[1] = "documents";
bicatalogObjectType[2] = "folders";
if (!Page.IsPostBack)
{
try{
if (boCatalog != null)
{
RecursivePopulateFolders(boCatalog.GetCatalog("", 0, mySort, bicatalogObjectType, null, null, InstanceRetrievalType.WITHOUTINSTANCE), this.TreeCtrl.Nodes);
//RecursivePopulateCategory(boCatalog.GetCategoryList("", 0, mySort, null, null), this.TreeCtrl.Nodes);
}
else
{
Response.Write("No items found catalog.");
}
}
catch (Exception ex)
{
Response.Write("Error occured:
" + ex.ToString());
}
}


// This Recursive Method Populate Folders from Business Object Reports with a url that will open the Business Report we want to see.
private void RecursivePopulateFolders( BICatalogObject[] catalogObjects, TreeNodeCollection nodes)
{
foreach (BICatalogObject catalogObject in catalogObjects)
{
if (catalogObject is Document)
{
Document doc = catalogObject as Document;
StringBuilder pathBuilder =new StringBuilder();
pathBuilder.Append(ConfigurationManager.AppSettings["REPORT_NAV_URL"].ToString());
pathBuilder.Append("&iDocID=" + doc.UID);
pathBuilder.Append("&sType=" + doc.FileType);
pathBuilder.Append("&sWindow=Same");
pathBuilder.Append("&sRefresh=" + ConfigurationManager.AppSettings["REPORT_REFRESH"].ToString());
pathBuilder.Append("&token=" + Token);
nodes.Add(this.CreateNode(doc.Name,pathBuilder.ToString(),doc.ObjectType, doc.Description,doc.UID.ToString()));
}
else
{
nodes.Add(this.CreateNode(catalogObject.Name, string.Empty,
catalogObject.ObjectType,
catalogObject.Description,
catalogObject.UID.ToString()));
}
}
}

Here the final result
PS: This image came from the Document:
"BUSINESS OBJECTS WEBSERVICES INTEGRATION":

Here some reference

static InstanceRetrievalTypeALL Return all documents
static InstanceRetrievalTypeINSTANCEONLY Return only documents containing a document instance
static InstanceRetrievalTypeWITHOUTINSTANCE Return only documents without a document instance

Here a .Aspx Example project you can use to integrate your with sharepoint:
You will need to download the .NET Consumer Library to use on the project.


Hope this help. :)
Post a Comment