How We Did It: Connectbeam Spotlight Connect for SharePoint
Overview
Connectbeam, founded in December, 2005, is a leading provider of enterprise social software applications and the first company to integrate concepts of social bookmarking and tagging with those of social networking. Connectbeam’s new Spotlight Connect for SharePoint provides SharePoint users with a single destination for discovering and sharing rich enterprise social bookmarking and tagging information. Spotlight Connect for SharePoint also extends and enhances the native collaboration and discovery capabilities of SharePoint Server 2007.
Spotlight Connect for SharePoint is implemented as a series of Web Parts and is enabled via Connectbeam’s REST-based APIs. Further information about the Connectbeam APIs is available at http://www.connectbeam.com/support/cbeam_api.
This blog entry describes how Spotlight Connect for SharePoint enhances SharePoint’s Enterprise Search and My Site capabilities by augmenting these native SharePoint features with enterprise social content from Connectbeam. This results in SharePoint users having a greater reach of “social discovery.” For example, SharePoint's Enterprise Search results can now be associated with Connectbeam’s Related Tags or Bookmarks, immediately revealing new and hitherto “hidden dimensions” of information discovery.
Additionally, SharePoint users can also interact directly with the core Connectbeam Spotlight social networking application to provide even richer social networking metadata and social discovery capabilities. This interaction is initiated simply by clicking on exposed Connectbeam data, such as Tags, in SharePoint.
The core Connectbeam Spotlight application is implemented as a secure “drop-in” hardware appliance that resides behind the corporate firewall. Connectbeam Spotlight interaction with SharePoint is performed via Web Parts and supports a Microsoft single sign-on infrastructure based on Active Directory.
Connectbeam Tags and Bookmarks
At the heart of the Connectbeam Spotlight application is the ability to apply and manage Bookmark and Tag information. This Bookmark and Tag information can be associated with any web content that has a URL. One convenient way of making this association is by using the Connectbeam “Bookmarklet”, which can be launched from the Connectbeam web browser toolbar. An example screenshot displaying the Connectbeam Toolbar is shown below:
Figure 1: Connectbeam Toolbar – Bookmarklet Launch Button is outlined in red
Clicking on the Connectbeam Bookmarklet button results in the actual Connectbeam Bookmarklet panel being displayed, and from here, any web content can be bookmarked and associated with any number of tags. This data is then centrally stored and managed by the Connectbeam Spotlight application. An example of the Connectbeam Bookmarklet is shown below.
Figure 2: Connectbeam Bookmarklet – specified tags are outlined in red
In the above example Bookmarklet, the Microsoft SharePoint Server web site home page is being bookmarked with the Tags: “Microsoft”, “SharePoint”, and “MOSS 2007”. Bookmark and Tag information like this (and other stored Connectbeam Spotlight social networking information, such as Users, Expert Communities, etc.) can now be visualized and leveraged in SharePoint via Connectbeam’s integration.
Connectbeam Integration Overview
This section of the blog entry discusses at a high level how some of the main features of Connectbeam’s integration with SharePoint have been enabled from both the user interface and software development perspectives. Technical details of the development of the Connectbeam integration Web Parts are described in the next section of the blog entry. Overall, the integration work was carried out by one developer and took approximately two weeks to complete. We were very pleased by the ease with which we can integrate with SharePoint.
A Web Part is a user interface component similar to the familiar controls that we see on ordinary web pages. However, in addition to providing “canned” UI functionality, Web Parts can also participate in SharePoint’s personalization infrastructure. That is, individual users can add, remove, and configure their own custom view of a SharePoint site by manipulating the Web Parts available to them. Connectbeam displays Web Part data in the Home and Profile areas of the SharePoint user’s My Site.
The My Home Web Part performs a SharePoint enterprise search for a given keyword and augments the standard SharePoint search results with Related Tags, Related Bookmarks, and Related Users social data from Connectbeam. An example of this is shown in the screenshot below. The SharePoint enterprise search results for the search term “java” are shown in the “Intranet search results” section of the Web Part. These SharePoint search results are supplemented by Connectbeam's “Related Tags”, “Related Users”, and “Related Bookmarks” social information. Clicking on any of this Connectbeam data will reveal further insight about this social data - either directly in a browser (for Bookmarks) or within the Connectbeam Spotlight application for other information.
Figure 3: My Home Enterprise Search Web Part
The My Profile Web Part shows user profile data from the SharePoint User Profiles Store and also displays the user’s social network Tags, Bookmarks, and Expert Communities data from Connectbeam Spotlight. By default, the standard SharePoint user profile data is displayed in the "About Me" tab. The Connectbeam Spotlight social content data is displayed by clicking on the “Social Content” tab.
Figure 4: My Profile Web Part showing the user's default SharePoint User Profile data
Upon clicking on the “Social Content” tab, Connectbeam Spotlight social content data (i.e. Bookmarks, Tag Cloud, Expert Communities) can be displayed. All of this social content is clickable and their content and relevance can then be explored more deeply within the Connectbeam Spotlight application.
Figure 5: My Profile Web Part showing the user’s Social Content from Connectbeam Spotlight
Technical Details for Connectbeam Integration Web Parts
The Web Parts described above were developed using the following implementations and sample code snippets:
· Create the Web Part class
1. Create a new class library project.
2. Inherit the class from Microsoft.SharePoint.WebPartPages.WebPart
· Create child controls
1. Override the CreateChildControls method of the Web Part base class
protected override void CreateChildControls()
{
base.CreateChildControls();
_tbxText = new TextBox();
_tbxText.Text = "java";
this.Controls.Add(_tbxText);
btnSubmit = new Button();
btnSubmit.Text = "Search";
btnSubmit.Click += new EventHandler(Search_Click);
this.Controls.Add(btnSubmit);
//Create label to show SharePoint search results
labelSrchRes = new Label();
labelSrchRes.Text = "Search Results";
labelSrchRes.Visible = false;
this.Controls.Add(labelSrchRes);
//Create label to show Related Bookmarks
labelRelBookmarks = new Label();
labelRelBookmarks.Text = "Related Bookmarks";
labelRelBookmarks.Visible = false;
this.Controls.Add(labelRelBookmarks);
//Create label to show Related Tags – similar to Bookmarks above
…
…
//Create label to show Related Users – similar to Bookmarks above
…
…
}
· Retrieve information from Connectbeam
To retrieve tags, users and bookmarks information, the user needs to login to the Connectbeam appliance. Code snippets in points 1 & 2 describes how the logging in and retrieval is performed.
1. Login to Connectbeam
String url = connectBeamApplianceUrl;
String cookies = null;
HttpWebRequest wrGETURL = (HttpWebRequest)WebRequest.Create(url);
wrGETURL.Method = "GET";
HttpWebResponse response = wrGETURL.GetResponse() as HttpWebResponse;
if (response.StatusCode == HttpStatusCode.OK)
{
cookies = response.GetResponseHeader("Set-Cookie");
}
2. Retrieving Tags, Users and Bookmarks information from Connectbeam
String strUrl = "";
Stream streamXML = null;
switch (strType)
{
case "Tags":
strUrl = relatedTagsUrl; // Use correct URL for your site.
break;
case "Users":
strUrl = relatedUsersUrl;
break;
case "Communities":
strUrl = relatedBookmarksUrl;
break;
default:
break;
}
HttpWebRequest wrGETURL = (HttpWebRequest)WebRequest.Create(strUrl);
wrGETURL.Method = "GET";
wrGETURL.Headers.Add("Cookie", cookies);
HttpWebResponse response = wrGETURL.GetResponse() as HttpWebResponse;
if (response.StatusCode == HttpStatusCode.OK)
{
streamXML = response.GetResponseStream();
}
3. XSL Transformation
Connectbeam returns a stream containing XML results. For showing these results in an HTML label control we transform them to HTML by applying a XSLT.
4. Transforming the results in HTML format after applying the XSLT
This code snippet describes how the XML results are transformed to HTML by applying the respective XSLT.
String strDataPath = Page.Server.MapPath("/data");
String strXSLFileName = "";
StringWriter sw = null;
XPathDocument doc = new XPathDocument(streamXML);
XslCompiledTransform xslt = new XslCompiledTransform();
switch (strType)
{
case "Tags":
strXSLFileName = strDataPath + "/cbeam_tags.xsl";
break;
case "Users":
strXSLFileName = strDataPath + "/cbeam_user.xsl";
break;
case "Communities":
strXSLFileName = strDataPath + "/cbeam_comm.xsl";
break;
default:
strXSLFileName = "";
break;
}
xslt.Load(strXSLFileName);
sw = new StringWriter();
xslt.Transform(doc, null, sw);
· SharePoint search on My Home page
The search is performed using the Search web service of SharePoint.
//The XML string containing the query request information for the Web service
string qXMLString="<QueryPacket xmlns='urn:Microsoft.Search.Query'>" +
"<Query><SupportedFormats><Format revision='1'>" +
"urn:Microsoft.Search.Response.Documentocument</Format>"+ "</SupportedFormats><Context><QueryText language='en-US'+
type='STRING'>" + keyword + "</QueryText></Context></Query></QueryPacket>";
QueryService queryService = new QueryService();
queryService.Credentials =CredentialCache.DefaultCredentials;
queryService.PreAuthenticate = true;
queryService.Url =searchServiceUrl;
System.Data.DataSet queryResults = queryService.QueryEx(qXMLString);
String strXML = queryResults.GetXml();
string strDataPath = Page.Server.MapPath("/data");
string strXSLSPResPath = strDataPath + "/SharepointSrch.xsl";
XPathDocument doc = new XPathDocument(new StringReader(strXML));
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load(strXSLSPResPath);
StringWriter sw = new StringWriter();
xslt.Transform(doc, null, sw);
labelSrchRes.Text = sw.ToString();
· Retrieving user profile data for a user
My Profile page displays user’s profile data. The user profile data is retrieved using the UserProfile web service of SharePoint.
UserProfileService profileService = new UserProfileService();
profileService.Url = userProfileServiceUrl;
profileService.Credentials = Credential;
PropertyData[] userProps = null;
userProps = profileService.GetUserProfileByName(userName);
· Render the Web Part user interface components
Override the RenderWebPart method of the Web Part base class.
protected override void RenderWebPart(HtmlTextWriter output)
{
output.RenderBeginTag(HtmlTextWriterTag.Br);
_tbxText.RenderControl(output);
btnSubmit.RenderControl(output);
output.RenderEndTag();
//Label to show SharePoint Search results
output.RenderBeginTag(HtmlTextWriterTag.Label);
labelSrchRes.Style["position"] = "relative";
labelSrchRes.Style["table-layout"] = "fixed";
labelSrchRes.Style["border-top"] = "#999999 thin solid";
//Repeat for border-left, -right, -bottom
labelSrchRes.Height = 400;
labelSrchRes.Width = 400;
labelSrchRes.Style["left"] = "0";
labelSrchRes.Style["top"] = "10";
labelSrchRes.RenderControl(output);
output.RenderEndTag();
//Label to show Related Bookmarks
output.RenderBeginTag(HtmlTextWriterTag.Label);
labelRelBookmarks.Style["position"] = "relative";
labelRelBookmarks.Style["table-layout"] = "fixed";
labelRelBookmarks.Style["border-top"] = "#999999 thin solid";
//Repeat for border-left, -right, -bottom
labelRelBookmarks.Height = 150;
labelRelBookmarks.Width = 200;
labelRelBookmarks.Style["left"] = "10";
labelRelBookmarks.Style["top"] = "10";
labelRelBookmarks.Style["overflow"] = "hidden";
labelRelBookmarks.RenderControl(output);
output.RenderEndTag();
//Label to show Related Tags – similar to Bookmarks above
…
…
//Label to show Related Users – similar to Bookmarks above
…
…
}
· Deploying the Web Parts to the SharePoint site
1. Copy the DLL to the bin folder of the SharePoint site.
2. Make a safe control entry for the dll in web.config of the SharePoint site.
3. Go to Site Actions->Site Settings->Web Parts->New.
Select My Home and My Profile Web Parts from the list and click on the Populate Gallery button. The Web Parts will now become available to use.
4. Go to Site Actions->Edit Page.
Click on Add Web Part.
Select the Web Part from the list.
This will render the selected Web Part on the site.
Adrian Paul
Senior Product Manager, Connectbeam Spotlight Connect for SharePoint