December 8, 2009
Quick little example of showing all entities in BCS. Shows off some abilities to gain access to these objects from within your sharepoint instance.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ Page Language="C#" %>
<%@ Import Namespace="Microsoft.SharePoint.BusinessData.SharedService"%>
<%@ Import Namespace="Microsoft.BusinessData.MetadataModel"%>
<%@ Import Namespace="Microsoft.BusinessData.Runtime"%>
<%@ Import Namespace="Microsoft.SharePoint.Administration"%>
<%@ Import Namespace="Microsoft.SharePoint"%>
<%@ Import Namespace="System.Collections.Generic"%>
<%@ Import Namespace="System.Diagnostics"%>
<%@ Import Namespace="System.Linq"%>
<script type="text/C#" runat="server">
protected void Page_Load(object sender, EventArgs e)
{
try
{
using (var site = SPContext.Current.Site)
{
using (new SPServiceContextScope(SPServiceContext.GetContext(site)))
{
BdcService service = SPFarm.Local.Services.GetValue<BdcService>(String.Empty);
var catalog = service.GetDatabaseBackedMetadataCatalog(SPServiceContext.Current);
List<IEntity> list = new List<IEntity>();
foreach (var i in catalog.GetEntities("*")) {
list.Add(i);
}
var ds = (from obj in list
let methods = obj.GetMethodInstances()
let properties = obj.GetProperties()
select new
{
Name = obj.Name,
Namespace = obj.Namespace,
Methods = (from item in methods select item.Key).ToList(),
Properties = (from item in properties select item.Key).ToList(),
}).ToList();
rptr.DataSource = ds;
rptr.DataBind();
}
}
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
}
</script>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta name="WebPartPageExpansion" content="full" />
</head>
<body>
<asp:Repeater runat="server" id="rptr">
<HeaderTemplate>
<table style="width: 100%;">
<tr>
<th style="text-align: left;">namespace</th>
<th style="text-align: left;">entity</th>
<th style="text-align: left;">properties</th>
<th style="text-align: left;">methods</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td style="text-align: left;"><%# Eval("Namespace") %></td>
<td style="text-align: left;"><%# Eval("Name") %></td>
<td style="text-align: left;"><%# String.Join("<br/>", (Eval("Properties") as IList<string>).ToArray()) %></td>
<td style="text-align: left;"><%# String.Join("<br/>", (Eval("Methods") as IList<string>).ToArray())%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</body>
</html>
November 22, 2009
New in SharePoint 2010 is the ability to just have a SpecificFinder and a Finder method on your external content type and still have searching / crawling work!
I’ve been scratching my head for awhile trying to get a WCF service crawled for content and been trying to use the older model which uses a SpecificFinder, Finder, and IDEnumerator to crawl an external line of business source (external content type).
Triggering the New Crawl Method
To tell SharePoint 2010 to use the new method of crawling all you need to do is mark your Finder with a <Property Name="RootFinder" Type="System.String"></Property> element.
Below is a snippet which is part of a sample I put together to show BCS in SharePoint 2010. It includes the model required and a simple WCF service along with instructions on how to deploy this.
I hope it gives you the jump start needed to configure and deploy a WCF BCS catalog.
<Method IsStatic="false" Name="GetContactList">
<Parameters>
<Parameter Direction="Return" Name="GetContactList">
<TypeDescriptor TypeName="BCSServiceProxy.Contact[], http://contacts.contoso.com/contacts.svc?wsdl" IsCollection="true" Name="GetContactList">
<TypeDescriptors>
<TypeDescriptor TypeName="BCSServiceProxy.Contact, http://contacts.contoso.com/contacts.svc?wsdl" Name="GetContactListElement">
<TypeDescriptors>
<TypeDescriptor TypeName="System.String" Name="FamilyName" />
<TypeDescriptor TypeName="System.String" Name="GivenName" />
<TypeDescriptor TypeName="System.String" ReadOnly="true" IdentifierName="ID" Name="ID">
<Properties>
<Property Name="ShowInPicker" Type="System.Boolean">true</Property>
</Properties>
</TypeDescriptor>
</TypeDescriptors>
</TypeDescriptor>
</TypeDescriptors>
</TypeDescriptor>
</Parameter>
</Parameters>
<MethodInstances>
<MethodInstance Type="Finder" ReturnParameterName="GetContactList" Default="true" Name="GetContactList" DefaultDisplayName="Contacts Read List">
<Properties>
<Property Name="UseClientCachingForSearch" Type="System.String"></Property>
<Property Name="RootFinder" Type="System.String"></Property>
</Properties>
</MethodInstance>
</MethodInstances>
</Method>
Download the full example here be sure to make a comment!
November 18, 2009
Been working on more and more BDC objects in BCS for SharePoint 2010 (I hate all these acronyms!). BUt it has been “enjoyable” getting various webparts and do-dads displaying information and it is brain dead easy to setup the links.
I worry about usability but for the moment that is taking a back seat – and I’ll do a deep dive into SharePoint 2010 Minimalist MasterPages as well as introducing JQUERY and REALLY standards based layouts to SharePoint 2010 when that time comes. For the moment getting data into the framework is priority #1, and with that below are some useful links I have found on the subject of BCS in SharePoint 2010.
Forums are always a good place to start
BCS
Support for Custom HTTP and SOAP Headers for BCS
SharePoint 2010 – Adding a Default Action to a Business Data Catalog Entity
Recommended Method Signatures for Stereotyped Operations for BDC
Creating Custom Actions in BDC – Action Element in Actions (BDCMetadata Schema)
everything-you-need-to-know-about-bdc-part-7-of-8
BDC Programming Model
Code Snippet: Execute a Method Instance on an External Content Type
BDC Security Trimming and AuthN + AuthZ
http://technet.microsoft.com/en-us/library/ee806886(office.14).aspx
BDC with Forms Based Authentication
BDC + WebService + SSO + FBA + SOAP Headers
Implement your own SSO for SharePoint
BDC with Forms Based Authentication (Using Roles and Groups)
BDC Search + Security Trimming
BDC Search with Security Trimming
Walkthrough: Using the Business Data Catalog Security Trimmer to Trim Search Results (Older 2007 But Should Still Apply)
Walkthrough: BDC Search and AccessChecker Samples
BDC Search – Performance Tip (disable audit to prevent SSP DB exponential growth)
The general concept I would like to prove out is FBA with an SSO and that SSO registered with each external data type defined in BCS. Then implement the BCS security trimming and see how it works out.
UI Improvements
Starter MasterPages in SharePoint 2010
SP2010 Branding Tip #7 – Using Simple Rendering in SharePoint Navigation
Quick overview of Master Pages in SharePoint 2010
Custom Buttons on Ribbon in SP 2010
Implementing BCS in Excel
BCS offers some compelling advantages when working with offline data. For example with Excel and BCS and SharePoint we can take lists offline and then sync them back in. Useful if we have people on the road or even in the office to get people their data in an excel format for massive updates or reporting. The two way sync is nice considering that excel 2007+ will use encryption and a local embeded sql instance to get access to this data.
BCS in Office Excel 2010