Like i promisse, have the webpart for sharepoint for Business Objects search, but i use the Business Objects web services consumer common classes.
You will need to convert the Business object Web Services in Class
To do That you will need to follow this steps:
Path "C:\Programas\Microsoft Visual Studio 8\SDK\v2.0\Bin"
wsdl.exe /l:CS /n:BusinessObjects.DSWS.Session /out:Session.cs http://[CMS_SERVER]:8080/dswsbobje/services/session?WSDL
wsdl.exe /l:CS /n:BusinessObjects.DSWS.BICatalog /out:BICatalog.cs http://[CMS_SERVER]:8080/dswsbobje/services/bicatalog?WSDL
wsdl.exe /l:CS /n:BusinessObjects.DSWS.ReportEngine /out:ReportEngine.cs http://[CMS_SERVER]:8080/dswsbobje/services/reportengine?WSDL
using BusinessObjects.DSWS.Session;
using BusinessObjects.DSWS.BICatalog;
using BusinessObjects.DSWS.ReportEngine;
or download .NET Consumer Library
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Xml.Serialization;
using Microsoft.SharePoint.WebPartPages;
using System.Net;
using BusinessObjects.DSWS.Session;
using BusinessObjects.DSWS.BICatalog;
using BusinessObjects.DSWS.ReportEngine;
namespace SearchBOXI
{
[Guid("a836931e-01ff-4c72-b7b3-ed18c1d97fc3")]
[Themeable(true)]
[XmlRoot("http://aaclage.blogspot.com")]
[ToolboxData("<{0}:SearchBO runat=\"server\" />")]
public class SearchBOXI : Microsoft.SharePoint.WebPartPages.WebPart
{
#region Variables
string html;
private string _BOServer = "http://localhost:8080";
private string _Password;
private string _Login;
private string _Domain;
private string _URLSession = "http://localhost:8080/dswsbobje/services/session";
private Button BtSearch;
private Label LbSearch;
private TextBox TxtSearch;
protected Auth _Auth;
private String link;
#endregion
public enum Auth
{
secEnterprise, secLDAP, secWinAD
};
public SearchBOXI()
{
this.ExportMode = WebPartExportMode.All;
}
#region Public Personalizable Properties
[WebBrowsable(true)]
[Personalizable(PersonalizationScope.User)]
[WebDescription("Business Objects Server Name")]
[Category("Business Objects Option")]
[WebDisplayName("Business Objects Server Name")]
public string BOServer
{
get
{
return _BOServer;
}
set { _BOServer = value; }
}
[WebBrowsable(true)]
[Personalizable(PersonalizationScope.User)]
[WebDescription("URL Web Service Session")]
[Category("Business Objects Option")]
[WebDisplayName("URL Web Service Session")]
public string URLSession
{
get { return _URLSession; }
set { _URLSession = value; }
}
[WebBrowsable(true)]
[Personalizable(PersonalizationScope.User)]
[WebDescription("Login")]
[Category("Business Objects Authentication")]
[WebDisplayName("Login")]
public string Login
{
get { return _Login; }
set { _Login = value; }
}
[WebBrowsable(true)]
[Personalizable(PersonalizationScope.User)]
[WebDescription("Password")]
[Category("Business Objects Authentication")]
[WebDisplayName("Password")]
public string Password
{
get { return _Password; }
set { _Password = value; }
}
[WebBrowsable(true)]
[Personalizable(PersonalizationScope.User)]
[WebDescription("Domain")]
[Category("Business Objects Authentication")]
[WebDisplayName("Domain")]
public string Domain
{
get { return _Domain; }
set { _Domain = value; }
}
[WebBrowsable(true)]
[Category("Business Objects Authentication")]
[DefaultValue(SearchBOXI.Auth.secEnterprise)]
[Personalizable(PersonalizationScope.User)]
[WebDescription("Authentication")]
[WebDisplayName("Authentication")]
public Auth Author
{
get { return _Auth; }
set { _Auth = value; }
}
#endregion
#region Create Child Control
protected override void CreateChildControls()
{
this.BtSearch = new Button();
this.BtSearch.ID = "_BtSearch";
this.BtSearch.Text = "Search";
this.BtSearch.Click += new EventHandler(BtSearch_Click);
this.LbSearch = new Label();
this.LbSearch.ID = "_LbSearch";
this.LbSearch.Text = "Document Search BO";
this.TxtSearch = new TextBox();
this.TxtSearch.Width = Unit.Pixel(250);
this.TxtSearch.ID = "_TxtSearch";
this.Controls.Add(LbSearch);
this.Controls.Add(BtSearch);
this.Controls.Add(TxtSearch);
base.CreateChildControls();
}
#endregion
void BtSearch_Click(object sender, EventArgs e)
{
Search();
}
private void Search()
{
try
{
BusinessObjects.DSWS.Connection boConnection = null;
string boConString = URLSession;
boConnection = new BusinessObjects.DSWS.Connection(boConString);
boConnection.Credentials = CredentialCache.DefaultCredentials;
//boConnection.Credentials = new NetworkCredential(Login, Password, Domain);
boConnection.IsKerberosAuthenticationEnabled = true;
EnterpriseCredential boCredential = new EnterpriseCredential();
if (Domain.Trim().Equals(""))
{ boCredential.Domain = string.Empty; }
else { boCredential.Domain = Domain; }
if (Login.Trim().Equals(""))
{ boCredential.Login = string.Empty; }
else { boCredential.Login = Login; }
if (Password.Trim().Equals(""))
{ boCredential.Password = String.Empty; }
else
{ boCredential.Password = Password; }
if (Auth.secEnterprise == Author)
{ boCredential.AuthType = "secEnterprise"; }
else if (Auth.secLDAP == Author)
{ boCredential.AuthType = "secLDAP"; }
else if (Auth.secWinAD == Author)
{ boCredential.AuthType = "secWinAD"; }
Credential val = new Credential();
Session boSession = new Session(boConnection);
SessionInfo boSI = boSession.Login(boCredential);
string Token = boSI.DefaultToken;
String[] strBOCatURL = boSession.GetAssociatedServicesURL("BICatalog");
BICatalog boCatalog = BICatalog.GetInstance(boSession, strBOCatURL[0]);
ReportEngine oDSWRE = new ReportEngine(boCatalog.Connection, boSession.ConnectionState);
BusinessObjects.DSWS.BICatalog.SortType[] mySort = new BusinessObjects.DSWS.BICatalog.SortType[1];
mySort[0] = BusinessObjects.DSWS.BICatalog.SortType.NAMEASC;
SimpleSearch mySearch = new SimpleSearch();
mySearch.InAuthor = Login;
mySearch.InName = this.TxtSearch.Text.Trim();
mySearch.ObjectType = "documents";
link = "";
BICatalogObject[] searchResults = boCatalog.Search(mySearch, mySort, null, null, InstanceRetrievalType.ALL);
foreach (BICatalogObject myBOCatObject in searchResults)
{
link = BOServer + "/businessobjects/enterprise115/desktoplaunch/InfoView/CrystalEnterprise_Webi/view.do?objId=" + myBOCatObject.UID + "&logonToken=" + Token;
html = link;
}
boSession.Logout();
}
catch (Exception ex)
{
html = "No values...
" + ex.Message;
}
}
protected override void Render(HtmlTextWriter writer)
{
try
{
EnsureChildControls();
this.LbSearch.RenderControl(writer);
writer.Write("
");
this.TxtSearch.RenderControl(writer);
this.BtSearch.RenderControl(writer);
writer.Write("
");
writer.Write(html);
}
catch (Exception ex)
{
writer.Write(ex.Message + " " + ex.StackTrace);
}
}
}
}