BCS / BDC Full Tutorial

for some reasons all posts work upside down - make a step, see the error, fix.

so lets go from start to end. you have an sql table and you want it in your sharepoint as a list or for search.

OOTB you can do it with SQL, WCF, or .net assembly. with some code you can make it work with almost anything, but some1 has done it already for you: http://lightningtools.com/products/bcs-meta-man-2010-and-2013/. they also have an extension for VS2010 (only), very nice.

STEP 1: have a sharepoint farm, web, site collection and web.
well i am kinda counting on you here, create youself all that until you have a web with the ability to create lists.
STEP 2: have an external content source. with permissions.
in our case its gonna be an sql table. and so you need a user that will have permissions to walk around in your data, and it needs to be the same one that will get permission in the bcs, and he should have permissions to your site. you should give permissions according to the actions you want to do (add, delete, read ect.)

STEP 3: establish a bdc SERVICE. and connect your web app to it.
 Central Administration -> Manage Services on Server and make sure that the BDC service is on


go to your Central Administration -> Application Management (AM from now) -> Manage Service Application -> New -> Business Data Connectivity Service (from now BDC). you can give it any name you can dream about. give the bdc permissions for the same user as above.


connect your web app to it. go to your Central Administration -> Manage Web Applications -> [your web app] -> Service Connection -> check your fresh new BDC.



for some reason in order for the bcs to forward its permisions when it connects you must run this powershell:

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

dont forget to change the name to your BDC name.

STEP 4: create an external content type.
easy part (unless you use 3rd party like metaman), just open Designer -> External Content Types (side nav) -> External Content Type (ribbon) and give it a name.


get inside and the bottom left is "External Content Type Operations" with a like at the bottom "Clik here to discover...".
Add Connection -> SQL Server -> [all those credents] -> OK.
you should see the tree of your DB as you know it from SQL and choose a table, right click and "Create All Operations"


save your work and get back to the previous screen and in the ribbon click "Edit Connection Properties and change authentication mode to BDC's Identity.


STEP 5: create external list.
for that you must activate the web feature "team collaboration lists" (רשימות של שיתוף פעולה בצוות)
now go to your site content and click add app (or create list for 2010) and choose external list and choose your content type.

THATS IT! GL & HF!

for search i made another post: http://bresleveloper.blogspot.co.il/2014/07/see-database-sql-data-in-sharepoint.html

and last a general little tip - if any1 is using metaman or is creating a feature to deploy his external content type and then want to deploy it to another site you'll get an error, the solution is to also change the url property in the feature's xml:
<Properties>
    <Property Key='SiteUrl' Value='http://spf.u2ucourse.com'/>
</Properties>
more here: http://weblogs.asp.net/jan/sharepoint-2010-bdc-model-deployment-issue-the-default-web-application-could-not-be-determined

Comments

Popular posts from this blog

c# Service Play Sound with NAudio example by Moshe

SOLVED The item could not be indexed successfully because the item failed in the indexing subsystem

JS/JQ simulate Enter event