PostRank Topblogs 2009 - #20 in Sharepoint

Windows Live Alerts web tracker
Chat with me if I'm online!
search blog
most popular
MCP MCTS MCT MVP

SP 2010: BCS problem with AuthenticationMode and RevertToSelf

Author: Tobias Zimmergren
http://www.zimmergren.net | http://www.tozit.com | @zimmergren

Introduction

I bumped into an issue the other week where I was creating a new BCS External Content Type and was hoping to hook up some new connections on a couple of demo farms I've created.

While most of these things were working like a charm, I bumped into an odd error message that basically told me that the elevation of privileges isn't enabled on my BCS Service Application.

Problem, a short story told even shorter

You might receive an error message like this when trying to hook up a new External Data Source depending on your configuration:

The metadata object that has Name 'yourName' has a Property with name 'AuthenticationMode' and value 'RevertToSelf'. This value indicates that the runtime should revert to the identity of the application pool, but reverting to the application pool must be explicitly enabled for the service application by a farm administrator.

Solution

While digging around for a couple of minutes I couldn't really find a suitable UI option for changing this behavior, so I dug into the power of PowerShell instead - which probably saved me quite some troubleshooting.

First you need to check the name of your Business Data Connectivity Service Application - a quick way is to check the UI, or you could use a PowerShell Cmdlet or use the API. I'm just using the UI for easy access:

image

Next, launch a new SharePoint 2010 Management Shell console and type in the following lines of code. Note that the name of the Service App below, is a copy of the name you took above:

$bcsServiceApp = Get-SPServiceApplication | where {$_ -match "Business Data Connectivity Service"}
$bcsServiceApp.RevertToSelfAllowed = $true;
$bcsServiceApp.Update();

This should now execute nicely (if you've got the appropriate permissions) and you should be able to see the RevertToSelfAllowed property be changed to true:

image

If you now would try to hook up your connections again, you should hopefully not see this message again.

Quick fix, done. Enjoy.


Published: Jun-09-10 | 2 Comments | 0 Links to this post

Access denied by Business Data Connectivity - Solution

Auhtor: Tobias Zimmergren
http://www.zimmergren.net | http://www.tozit.com | @zimmergren

Introduction

Lately I've been rolling around parts of Sweden and doing training, seminars and workshops on SharePoint 2010 with a bunch of companies and people.

One thing that I've been showing off, which I'm totally in love with by the way, is the BCS (Business Connectivity Services) functionality.

I've been getting a few questions from people who have been trying this out, but stumbled onto some problems with it in terms of permissions when they tried it out themselves.

Problem - Access Denied by Business Data Connectivity

When you've created your external list and try to access it (even as the same user, Administrator, that created it) you might get the following error:

image
Access denied by Business Data Connectivity

If you bump into this, please don't freak out - just keep reading..

Solution - Permissions on the BCS Entity

To resolve this so called problem, follow along here:

Go to Central Administration -> Application Management -> Manage Service Applications -> Business Data Connectivity Service* -> [Your Entity] -> Set Permissions

* or whatever name you've chosen for your BCS Service application

image

Configure the actual permissions

In my case below, I've just told SharePoint that my Farm Administrator should be able to do all actions (Edit, Execute, Selectable in Clients and Set Permissions)

image

Please note: You might want to use different permissions in your environments - the permissions set in this blog post is just to demonstrate how you effectively change/add permissions for your BCS Entities to get up and running.

Check your external list

You should now be able to access the external list and see the desired result.

image

Keep rocking folks!

Cheers


Published: May-08-10 | 19 Comments | 0 Links to this post

SP 2010: Programmatically work with External Lists (BCS) using the Client Object Model

Author: Tobias Zimmergren
http://www.zimmergren.net | http://www.tozit.com | @zimmergren

Introduction

Article 3 in the small BCS-series:

1. SP 2010: Getting started with the Business Connectivity Services (BCS)
2. SP 2010: Programmatically work with External Lists (BCS) in SharePoint 2010
3. SP 2010: Programmatically work with External Lists (BCS) using the Client Object Model

In my previous article in the series, I talked about how easy it is to fetch information using the standard SharePoint server API-approach. In this article I will talk about how you can access data in your BCS data source, by utilizing the Client Object Model.

Client Object Model code to read from the external list

Just like I described in my previous article, you now have the awesome ability to work with data in your External Lists (connected to a data source using BCS) - namely, you can use the standard SharePoint APIs.

Since I've shown you how you can do this using the Server Object Model, I thought I could take another spin at it and show you the code for doing basically the same with the Client Object Model.

The underlying data

As with my previous article, I'm still using the same data source as I set up in my first article - the "ProductList" table in my SQL Server database called "Zimmergren_DB"

As seen in the SQL Server Management Studio:
image

Let's fetch the data using a Windows Forms application that utilizes the Client Object Model!

I've designed a Windows Forms application to utilize the .NET Client Object model (in contrary to using the Silverlight client object model or JavaScript client object model).

It looks like this:
 image

When you click the fancy button called "Get External Data", it will use the Client Object Model to fetch the records from the external list (from the SQL server) and display them in a DataGridView. Nothing fancy.

The code!

With no further delays or chit-chat, here's the simple code!

    // Define the Client Context (as defined in your textbox)
    SP.ClientContext context = new SP.ClientContext(tbSite.Text);
    SP.Web site = context.Web; 

    var ProductList = site.Lists.GetByTitle(tbList.Text); 

    SP.CamlQuery camlQueryAwesomeness = new SP.CamlQuery();  

    IQueryable<SP.ListItem> productItems =
                                      ProductList.GetItems(camlQueryAwesomeness); 

    IEnumerable<SP.ListItem> externalList =
                                      context.LoadQuery(productItems);

    // This is where we actually execute the request against the server!
    context.ExecuteQuery(); 

    // Retrieve the products from the product list using some fancy LINQ
    var productListData = from product in externalList
      select new
      {
          // We're never pointing to the field at the 0-index
          // because it's used by the BDC Identity itself. Hence our elements start at 1.
          ProductID = product.FieldValues.ElementAt(1).Value.ToString(),
          ProductName = product.FieldValues.ElementAt(2).Value.ToString(),
          ProductDescription = product.FieldValues.ElementAt(3).Value.ToString()
      }; 

    // Simply clear the rows and columns of the GridView
    gvProducts.Rows.Clear();
    gvProducts.Columns.Clear(); 

    // Add the columns we need (ProductID, Name, Description)
    gvProducts.Columns.Add("ProductID", "ProductID");
    gvProducts.Columns.Add("Name", "Product Name");
    gvProducts.Columns.Add("Description", "Product Description");
    foreach (var product in productListData)
    {
        // For each product in the list, add a new row to the GridView
        gvProducts.Rows.Add(
                                 product.ProductID,
                                 product.ProductName,
                                 product.ProductDescription
                                 );
    }

References and recommended reading

  1. Getting Started with the Client Object Model in SharePoint 2010
  2. Getting Started with Business Connectivity Services in SharePoint 2010

Summary & Download

At this point, I've showed you three short articles in which I describe how you can set up a Business Connectivity Services data source - then utilize the Server OM or Client OM to fetch information from that external data storage.

Worth to note is that this is still a Beta product, which of course means that it may differ in functionality and performance in comparison with the final (RTM) version of SharePoint 2010.

Download the complete Visual Studio 2010 project here: [ Zimmergren.SP2010.ClientOM.BCS.zip ]


Published: Jan-21-10 | 6 Comments | 0 Links to this post

SP 2010: Programmatically work with External Lists (BCS) in SharePoint 2010

Author: Tobias Zimmergren
http://www.zimmergren.net | http://www.tozit.com | @zimmergren

Introduction

Article 2 in the small BCS-series:

1. SP 2010: Getting started with the Business Connectivity Services (BCS)
2. SP 2010: Programmatically work with External Lists (BCS) in SharePoint 2010
3. SP 2010: Programmatically work with External Lists (BCS) using the Client Object Model

In my previous article I talked about how you can set up a simple BCS configuration to fetch and work with external data in SharePoint 2010. In this article I will talk about how you can utilize the SharePoint 2010 object model to work with that external data, directly from the SharePoint API. It's all really simple!

Working with data in an External List using the SharePoint Object Model

The code in this sample doesn't really differ from the way you fetch information from any other list in SharePoint (2007 or 2010). This - of course - is very welcomed news, as we do not need to learn any new frameworks or tools to work with the data in our external lists. It simply works as any other SPList, basically.

Retrieving external data, made simple:

When fetching items from an external list, you can simply do that by utilizing the good-old SPList object. We do not need to work with any other types of namespaces or frameworks in order to do this.

In my SQL Server I've got a table called "ProductList".
This list is filled with the following data:

image

Fetching some items from the external list, and displaying them in a console app:

// Product List is my external list, that is working with data in the SQL Server!
SPList list = web.Lists["Product List"];

SPQuery q = new SPQuery();
q.Query =
    "<Where><IsNotNull><FieldRef Name='ProductID' /></IsNotNull></Where>";
q.RowLimit = 100;

SPListItemCollection col = list.GetItems(q);

foreach (SPListItem item in col)
    Console.WriteLine(item["Name"].ToString());

This will render the following result (fetched from the database):

image

The things you see in the console windows is fetched straight from the SQL Server (using a BCS connection through the External List).

Writing data to the External List (hence, writing to the SQL Server)

Seriously, this is way too easy as well...

// Get the external list
SPList list = web.Lists["Product List"];

// Use the traditional approach to create SPListItems and hook it up with the list
SPListItem item = list.Items.Add();
item["Name"] = "Sample Product Wohoo";
item["Description"] = "Sample Description Wohoo";
item.Update();

Upon running this code in your SharePoint application, it will create the SPListItem object and add a Name and Description. When you hit .Update() it will push this data through the data source connection, to your SQL server.

Here's what the updated data looks like:
image

We're running a Beta-product!

As you can imagine, there's a ton of new cool things to work with in SharePoint 2010 - where the BCS is one. This article discuss the very basics of how you can retrieve information from these lists using the normal API-approach.

At the time of this writing (during Public Beta) there isn't any measures on performance and what impact it has on the server in comparison to alternative ways to fetch and work with the data.

As time goes on, there will be probably be some new information on this - I'll keep you posted when I know more.

Summary

As you can see, working with external data from the SharePoint API isn't very hard to do. What you need to make sure is to have an external list set up somewhere (see this article for how you can do that) and then you can simply use the normal SPList object from the SharePoint object model to work with the external list and it's external data from the SQL server (in my case).

So if you haven't already: Get on the SharePoint 2010 wagon and enjoy the ride!


Published: Jan-19-10 | 7 Comments | 0 Links to this post

SP 2010: Getting started with Business Connectivity Services (BCS) in SharePoint 2010

Author: Tobias Zimmergren
http://www.zimmergren.net | http://www.tozit.com | @zimmergren

Introduction

Article 1 in the small BCS-series:

1. SP 2010: Getting started with the Business Connectivity Services (BCS)
2. SP 2010: Programmatically work with External Lists (BCS) in SharePoint 2010
3. SP 2010: Programmatically work with External Lists (BCS) using the Client Object Model

BCS in SharePoint 2010 is an awesome refinement of the Business Data Catalog from MOSS 2007. With BCS - or Business Connectivity Services - you get the possibility to connect external data and work with it from SharePoint.

In this article I will not cover the basics of what BCS is all about (MSDN/TechNet does this very well) - I will rather give you a walkthrough of how you can setup a BCS connection to an external database, and then work with this information directly from a SharePoint list - without the user actually knowing anything about the connection to the database.

BCS Poster: Business Connectivity Services Poster
BCS Team Blog: http://blogs.msdn.com/bcs/

A sample SQL database

I'll just show you how my sample database is set up - simply create a new database in your SQL Server and have it filled with some example data. In my case, this is the data in my SQL database, called Zimmergren_DB:
image

In this sample database, I've added a table called ProductList which in theory will represent some products in this database, like this:
image

I'm filling the database with some sample data, so we will be familiar with this data when we later watch this information from SharePoint:
image

Alright - we have some sample data in our SQL Server. Nothing fancy, just some very simple data. Great, let's get going with the fun stuff!

Creating an external content type

The most effective and easy way to set up a simple BCS connection, is to use SharePoint Designer 2010. You heard me, we can now get up and running with BCS by using SPD instead of modeling complex ADF files and things like that.

In order to do this, we need to create a new External Content Type!

Here's how do create our External Content Type and hook it up with our database, step by step:

  1. Open the site you want to work with using SharePoint Designer 2010
  2. Select "External Content Types" in the left hand navigation:
    image
    Loading this page might take some time, be patient!
  3. Click to create a new External Content Type like this:
    image
  4. Click the link that reads: "Click here to discover external data sources and define operations":
    image
  5. Click "Add Connection"
    image
  6. Select "SQL Server" as your Data Source Type:
    image
  7. Enter the details about your connection to your SQL Server:
    image
  8. When the connection is made, your Data Source Explorer will be filled with the database you have specified. Now choose the table you want to work with, and right-click and select "Create All Operations":
    image 

    You'll be presented with a wizard-like dialog where you can specify the operations, elements and other properties for your BCS connection.
  9. Click "Next" to get to the Parameters page
  10. Select the field that you want to act as an Identifier. In my case I've selected my ProductID just to get on with it:
    image
  11. Click "Finish"
  12. You'll be presented with a list of operations that your External Content Type can do, like this:
    image

That's it. A few points, a few clicks - and you're done. Let's create an external list (using the Browser to show how simple it is..) and hook up our external content type with it!

Creating an external list

There's a few ways to create an external list in SharePoint 2010. We will create it using the Browser UI to show you how simple it can be.

  1. Open your site and choose Site Actions - More Options…
    image
  2. Select the External List template, and click Create
    image
  3. Enter a name for your list, e.g. Product List
  4. You'll see a field in this list called External Content Type, click the browse-button beside it:
    image

    What is really awesome here, is that you're now presented with a dialog where you simply can choose the data source for this list. That means, you'll select the data source you've created (mine is called Zimmergren_DB). Then your list will automatically work against the SQL database, but still have the look and feel of a SharePoint 2010 list.
  5. Select your data source and click OK:
    image
  6. Now simply click the button called Create:
    image

Would you look at that! You're now working with external data, from your (what looks to be) normal SharePoint list! This is brilliant!

You now have the ability to create new items, update existing items, delete items and do all your normal CRUD-operations (CRUD = Create, Read, Update, Delete) straight from the SharePoint 2010 list.

Proof of concept - Adding a new product

Let's just for the fun of it add a new product called "Awesome Product 1.0" like the following screenshot:
image

Now go to your SQL Server and see the changes take effect immediately. The data is NOT stored in SharePoint, it's stored in your SQL Database.

This is what my table now looks like in the SQL Server, after adding a new item in the SharePoint list:
image

Summary

With a few points, followed by a few clicks - you've set up your external data connection. Basically it's that simple.

Of course there's a lot of things to consider when doing these configurations - and you might not want to auto-generate the CRUD-operations, but rather create them one by one and specify more fine-grained permissions etc.

This is merely a sample to show you how easy it is to actually get up and running with the SharePoint 2010 Business Connectivity Services (BCS) and work with external data!

Enjoy


Published: Jan-18-10 | 14 Comments | 0 Links to this post

SharePoint BDC Part 2: Creating your first BDC Web Part

Author: Tobias Zimmergren
URL: http://www.zimmergren.net | http://www.tozit.com | @zimmergren

Introduction

In my previous article (SharePoint BDC Part 1: Getting started with the Business Data Catalog) I talked about what you'll need to do in order to begin to work with the BCD in SharePoint (MOSS 2007 specifically, as it's an Enterprise feature).

In this article I will briefly guide you through the process of creating your first BDC Web Part that will communicate with the BDC.

Note: You can download the source code for this sample project here [Download]

Prerequisites

You need to have your BDC set up and ready to use before you can start creating your own BDC Web Parts to communicate with the BDC. (See my previous article for a walkthrough)

We will also use Microsoft Visual Studio (2005/2008) to create the Web Part.

Enjoy!

What we had -> where we're going

In the previous article I talked about using the built-in Web Parts for your BDC needs. Although they fill a lot of requirements, sometimes you just might want to write your custom Web parts instead.

This is what the standard BDC list looks like:

image

This is what the final result will look like: (Note, this is a custom Web Part which you'll develop in the following steps)
image

Step 1 - Create a new Web Part project

I will expect that you already know how to create a new Web Part project (either using the VSeWSS or using WSPBuilder, or any other tool of preference).

See this article for a WSPBuilder complete walkthrough: WSPBuilder - Walkthrough of the Visual Studio Add-in

Step 2 - Add the BDC references to your project

Once you've got a Web Part project up and running, you should add some references that are needed for the BDC Object Model.

You should add the "Microsoft® Office SharePoint® Server component" reference to your project:
image

Once you've added this reference to your project, you have a GO for using the BDC namespaces.

Add the following using-statements to the top of your Web Part:

using Microsoft.Office.Server.ApplicationRegistry.MetadataModel;
using Microsoft.Office.Server.ApplicationRegistry.SystemSpecific.Db;
using Microsoft.Office.Server.ApplicationRegistry.Runtime; (if you need it..)

This is what my Visual Studio project looks like when using the WSPBuilder to create my Web Parts (notice the reference to microsoft.sharepoint.portal which comes from the reference we added):
image

Now we're good to go! Let's start coding then!

Step 3 - Utilize the BDC object model to access data

Note, you can download the complete Visual Studio Project at the end of this article with the source code.

Fetches all the LOB instances from the metadata repo:

var myInstances = ApplicationRegistry.GetLobSystemInstances();

 

Fetch the HR instance for Human Resources:

var humanRecourcesInstance = myInstances["HR"];

 

Pick out the Department entity from the HR instance:

var departmentEntity = humanRecourcesInstance.GetEntities()["Department"];

 

Fetches the method GetDepartments which is specified in our ADF file (Application Definition File) for our BDC connection:

var getDepartmentMethod = departmentEntity.GetMethods()["GetDepartments"];

 

Fetches the MethodInstance DepartmentFinderInstance:

var deptFinderInstance =
      getDepartmentMethod.GetMethodInstances()["DepartmentFinderInstance"];

 

We call the departmentEntity.Execute() method to fetch DbEntityInstance's:

var foundEntities = 
     (DbEntityInstanceEnumerator)departmentEntity.Execute(
                                                                          deptFinderInstance, 
                                                                          humanRecourcesInstance);

 

Simply loop the DbInstances and then shoot out their name in a bunch of literal controls.
In a real scenario, we would most likely add those intances to an SPGridView instead of printing Literals to enable Views, Sorting, Paging and a whole set of awesome features that comes with the Grid View.:


while (foundEntities.MoveNext())
{
    var currentDepartment = (DbEntityInstance)foundEntities.Current;
    Controls.Add(new Literal{Text =
              "<div style='border-bottom:1px dashed #c0c0c0; width:100%;'>"});

    Controls.Add(new Literal {Text =
              currentDepartment.GetFormatted("Name")+ "<br/>"}); 

    Controls.Add(new Literal { Text=
currentDepartment.GetFormatted("DepartmentID").ToString() }); 

    Controls.Add(new Literal{ Text = "</div>" });
}

When you've written the aforementioned code, you will have the base set up for retreiving data from your BDC connection. You will (of course) have to dig a whole lot deeper if you want to master the arts of BDC and the object model that comes with that. But at least it's a start for you to get to know the namespace, and learn what namespaces to use - and see that it actually works!

Step 4 - Finalize and deploy your Web Part

Once you've created the project, build it and deploy to your SharePoint development machine and add your Web part to see the action:

image
(Yes, the Web Part is called SharePointRules BDC Web Part - and for a good reason too!)

Step 5 - May your creation shine upon SharePoint! (aka. Final result)

This is what the creation looks like (wow..), which basically only utilize the most basic aspects of the BDC Object Model to get started - but here you have it in action, fetching data immediately from your back-end SQL server (Adventure Works database in this case) using the BDC:

image

Summary

That's a wrap for this article. I have walked you through the few simple steps needed to create your own first BDC Web Part.

In my next BDC article I will talk about what alternative tools I find suitable to use for generating your ADF (Application Definition File).

 


Published: Jul-25-09 | 5 Comments | 0 Links to this post

SharePoint BDC Part 1: Getting Started with the Business Data Catalog

Author: Tobias Zimmergren
URL: http://www.zimmergren.net | http://www.tozit.com 

Introduction

In this article I will guide you through the very basics of getting started with Business Data Catalog, BDC:

  1. Install the AdventureWorks 2008 Sample Databases
    1. We will use this database as our example for retrieving data using the BDC.
  2. I will step you through the simple process of creating your ADF (Application Definition File)
    1. We will use this file as our import connection
  3. I will guide you through how we can import this ADF file and create our BDC Application
  4. Lastly, I will guide you through the process of creating a basic site and use some of the basic BDC Web Parts

Install the AdventureWorks sample database

  • You'll need to go and download the AdventureWorks sample databases
    image

  • Just finish the installation by clicking next a couple of times and let the installer do it's normal Microsoft-installer magic.
  • You should now see a couple of new databases in your SQL Server Management Studio:
    image
    AdventureWorks, AdventureWorks2008, AdventureWorksDW, AdventureWorksDW2008, AdventureWorksLT, AdventureWorksLT2008

Alright - We've got our databases, now we need to start thinking about how we will get data from our SQL server into SharePoint. This is done by creating/generating an Application Definition File (ADF) as you will see in the next section.

Creating the ADF (Application Definition File)

Alright, there's a few different options to create your ADF (Application Definition File). I will show you how to get started with using the free tool called "Application Definition Editor" that comes with the latest SharePoint Server SDK.

Note: See the bottom section in this article for a summary of links to all resources mentioned in the article.

After you have installed the latest SDK, you can choose to install the "Microsoft BDCTool" located here by default: "C:\Program Files\2007 Office System Developer Resources\Tools\BDC Definition Editor". Which will give you the following item in your Start Menu:
image

Launch the BDC Application Definition Designer

Click the application and launch the editor. You will see an interface like this:
image

Create or import your ADF file

There's basically two alternatives when it comes to editing an ADF (Application Definition File).
One is to create a new one (which I will guide you through first), and the other is to import an existing one (which I will show you after the first alternative).

Alt 1) Creating our own ADF file
Now we're going to connect to our newly created sample-databases and create an ADF file for use with those databases.
  • Click on ADD LOB System
  • Choose Connect To Database
  • You will see a nice popup-dialog where you will be able to enter the connection details to your desired database
    • Enter your connection details, example:
       image
  • You are presented with the "Designer Surface" that looks something like this:
    image
  • In our case, we're going to use the table called "vEmployee" which exist in the AdventureWorks database in order to pull out some information about our employees.
    • Search for the table called vEmployee and drag it out to the Design Surface
    • Search for the table called vEmployeeDepartments and drag it out to the Design Surface
    • It should look something like this:
      image
    • Make any necessary changes, then click OK
    • You'll see a view similar to this one after some tweaking:
      image 
    • After you've done the necessary changes to your configuration, making sure it's a valid ADF with proper filters, enumerators and methods or whatever you need in your application then smile, because we're done with that part!
Alt 2) Importing an existing ADF file

If you don't want to do everything from scratch or you've already got an ADF file that you wish to modify, you can do so by importing an existing ADF file into the Definition Editor. Here's how:

  • Open the BDC Definition Editor tool, then click the "Import" button in the menu:
    image
  • Browse to your existing ADF file and choose to import it. Simple as that.
    (I am importing a file called BDCAWDW.xml, which contains definitions for Product, Reseller, ProductSubcategory, ProductCategory as shown below)
  • You'll see the imported ADF file's structure immediately in the designer, under the prerequisite that your SQL connection string in the ADF file is valid:
    image 

Note: I will not detail how you create filters, finders, methods etc. in this article. You can read more about that here:
http://msdn.microsoft.com/en-us/library/ms145931(SQL.90).aspx

I may cover the topic of ADF-functionality in another article later on.

Generate the ADF file from the designer

I really don't need to tell you this, but there's a button called "Export" which you use to export the definition you've created using the definition editor to an xml file:
image

Import the ADF file

If we have gotten this far, we might as well get the last few bits in place.
What we now need to do is to import our ADF file into SharePoint, since that's where it should reside. Follow along with these few simple steps to make sure you're properly importing your file into SharePoint.

  • Navigate to your Shared Services Provider Administration site (You can access your SSP through Central Administration)
  • You are presented with a section called "Business Data Catalog" where you'll find a bunch of different alternatives.
  • Make sure you have the permissions to modify the BDC (See the link Business Data Catalog permissions)
  • Click "Import application definition"
    image  
  • Browse for your .xml file and click "OK":
    image
  • You'll see a progress bar (You don't see that a lot in SharePoint. I love it!), telling your how the import process is going:
    image
  • When it's done, you'll click "OK" and be presented with an overview of your imported BDC Application:
    image
Configure permissions on the BDC Application Definition

In order for all users to be able to select/read data from your BDC Application, you'll need to make sure they've got the appropriate permissions to actually do so.

Usually I do this setting on each of the imported entities, in case you want specific permissions on different entities - instead of on the entire application.

  • Select the DropDown list on your first entity and choose "Manage Permissions":
    image 
  • Choose "Add Users/Group":
    image
  • Enter "NT AUTHORITY\AUTHENTICATED USERS" and choose "Select in Clients":
    image
  • Repeat these steps for the other entity as well.
  • You're done.

Now we have created or imported an ADF file with the Business Data Catalog Definition Editor tool, exported it to an .xml file, imported it into SharePoint, set basic permissions on the entities.

Next, we should make sure that the application works in SharePoint by adding a Business Data Catalog-WebPart to a page.

Use the basic built-in BDC Web Parts

Awesome. Now that we have gotten this far by importing an ADF file into SharePoint and set appropriate permissions on the entities - We're ready to actually use the ADF connection to view stuff in our database.

Note: I have created a new blank site where I can easily show the built-in BDC Web Parts - so that's where I am adding my Web Parts.

 

  • Add two Web Parts to your page called "Business Data List" and "Business Data Item":
    (Note that when you've configured a BDC application, you'll see the Business Data web parts)
    image
  • Choose to edit the properties of the Business Data List Web Part:
    image
  • Click the Browse-icon to the right to pop up the BDC entity chooser:
    image
  • It will present you with the following interface (note, BDC applications will of course vary depending on what you have imported..):
    image 
  • Double click the "Employee" type, and then click "OK" in your Web Part property window.
  • Repeat this process for the "Business Data Item" Web Part, and select "Employee" in the BDC Type Picker as well.

Now we've got one BDC List Web Part which will list all employees, and one BDC Item Web Part that will display details about the employee we select.

In order for this to work we must connect the two Web Parts.

  • Edit menu of your Web Part -> Connections -> Send Selected item To -> Employee
    image

Test our BDC Application out, and make sure it works!

  • Choose "LastName" then "contains" and enter "smith":
    image
  • Select one of the results by clicking the radiobutton to the left, and see that the result (details) about the Employee shows up in the connected Web Part:
    image 

Resources and links

Summary

This article is a basic step-by-step guide to getting started with BDC in MOSS 2007. I've shown you every step from creating the databases required (in our case some sample databases) to creating the ADF file and to finally utilize the BDC connection from a site, using the BDC Web Parts.

In an upcoming post I will talk about how you can create your own BDC Web Parts! Keep your eyes open!


Published: Jun-25-09 | 49 Comments | 0 Links to this post