Monday, 1 August 2011

Enable search on an External Content Type in SharePoint 2010 using PowerShell

When you create a custom BDC External Content Type (or “Entity”) for use in SharePoint 2010 and deploy it in the Business Data Connectivity Service Application, it will not be “crawlable” from the SharePoint search application by default.

There is a great article from Chaks here on the detail, so I do not see any need to repeat the article he has written. However, one approach that may be preferable when configuring the entity and Lob System Instance could be to use PowerShell instead.

In my example, I have created a very simple External Content Type (ECT) to show a people table from a SQL database. As you can see from the screenshot below, the option to crawl the ECT is set to “No”:


To retrieve the ECT for configuration in PowerShell, you can use the Get-SPBusinessDataCatalogMetadataObject cmdlet provided with SharePoint 2010. The script below will retrieve the “People” ECT shown above:

$entity = Get-SPBusinessDataCatalogMetadataObject -BdcObjectType "Entity" -Name "People" -Namespace "http://portal.pacdomain.local" –ServiceContext “http://centraladminURL:port

Next, the following lines of script retrieve the “ReadList” method instance, as suggested in Chaks article:

$methodinstance = $entity.MethodInstances | where {$_.Name -eq "ReadList"}

It is here that we need to add the “RootFinder” property. If you wish to view a list of the current properties set on the method instance, simply type $methodinstance.Properties. To add a new property, type the following command:

$methodinstance.Properties.Add("RootFinder", "")

You may also wish to switch on the optional “UseClientCachingForSearch” property, which can speed up the crawls to the ECT, but ensure that you read this article first before doing so as there are some caveats to think about:

$methodinstance.Properties.Add("UseClientCachingForSearch", "")

Once you have finished making these changes, update the method instance as follows:


The ECT will now show as “Crawlable”:


Note, that you can also use the “Remove” method to delete any property set on the method instance. This could be used to remove the search option on an ECT – even those created in SharePoint Designer, where the “crawlable” option is switched on by default. For example, type the following to remove the “UseClientCachingForSearch” property:


Next, we need to switch on the “ShowInSearchUI” property for the Lob System Instance. This allows the BDC model instance to be seen in the SharePoint search administration interface when creating a content source to crawl business data. At this point you will need to know the name of the Lob System Instance for this ECT – if you’re not sure what this is, type $entity.LobSystem.LobSystemInstances to find it. In this example, the name is “Test Database”:


We can now use this name to get the Lob System Instance, configure the ShowInSearchUI property, and update the item:

$lobSI = $entity.LobSystem.LobSystemInstances | where {$_.Name -eq "Test Database"}
$lobSI.Properties.Add("ShowInSearchUI", "")

Again, the property can be removed using the “Remove” method as before, should you wish to hide a Lob System Instance from the search administration interface again.


  1. Thank you !!! for sharing above power shell code was very useful for me ..

  2. That's a great post, works like a charm :)

  3. Model Karrueche Tran is in the headlines a lot at the moment. She’s controversial rapper Chris Brown’s ex for one thing. And of course now that Brown and Rihanna are back together there’s rbodm much speculation on the nature of Brown’s continued friendship with the model.Today, though we’re more interested in those stylish Dior Homme sunglasses. Karrueche spotted here out and about ray ban store in L.A soon after her split with Ray Ban Sale Brown, showed her style mettle with a really neat choice of designer sunglasses to hide that very public gaze.Karrueche chose the Dior Homme Black Tie in havana as she hit the streets of L.A. The Black Tie is a modern aviator with a distinctive brow that really accentuates the eyeline.It’s ray bans on sale a perfect moving on accessory for Karrueche who is now said to be getting close to Brown’s friend, Kendrick Lamar. So more headlines to follow then...
    Jessica Chastain ray ban wayfarer is a very happy lady it would seem. The quiet star is flourishing in a new romance with a tall dark Italian, and was the first female actress ray ban aviators in 50 years to have a leading role in hit movies at the same time with Mama and Zero Dark Thirty.There’s last year's Time 100 most influential people listing ray ban one day sale 90% off too. So what do the world’s best wear on their eyes? One of designer eyewear’s best – Persol sunglasses.Persol 3015 is a striking frame and perfect for cheap ray ban sunglasses sale under 30$ this strikingly beautiful actress. The retro shape is so typical of the 50s silver screen heyday, while as a pair of sunglasses the Persol 3015 comes with that ray ban clubmaster ‘Made in Italy’ stamp that exudes quality craftsmanship.Recently spotted at Paris Fashion Week , Chastain was snapped admiring her new man Gian Luca Passi de Preposulo. Jessica Chastain cheap ray bans is known for her incredible style and Preposulo is an executive at French fashion house Moncler.So it’s not just Jessica’s Persol sunglasses that have a ‘Made in Italy’ designer cheap ray bans for sale

  4. The blog or and best that is extremely useful to keep I can share the ideas of the future as this is really what I was looking for, I am very comfortable and pleased to come here. Thank you very much.
    animal jam | five nights at freddy's | hotmail login


  5. الان مع افضل ما توصل له علم الديكورات الحديث من تصميمات نقدم لكم جماليات ورق جدران ثلاثى الابعاد بطلائاتها الجديدة لمنتجات ورق جدران ثلاثي الابعاد فى الرياض فالان ان كنت بمرحلة الانشاء لمنزلك وترغب فى تصميم افضل الديكورات بمنزلك واختيار افضل دهانات الحوائط او ورق حائط ثلاثي الابعاد و ورق الجدران لغرف النوم وايضا دهانات دكتور بينت فكل انواع الدهانات الحديثة نقدمها لكم عملائنا الكرام .

    نحن نقدم كل جديد فى عالم الديكورات ونوفر لكم ورق جدران للمطبخ وللصالات بافضل استايل وخاص فقط بنا وبجودة عالية جدا ولكل من يبحث عن الرقى والجودة فنحن نقدمها لك باقل الاسعار وبافضل الخامات للارضيات والحوائط وكافة اعمال الديكورات ونقدم لعملائنا التى تم التعامل معهم افضل انواع الديكورات مثل ورق الجدران ثلاثى الابعاد بالرياض وبجدة وبالدمام الذي يجعل منزلك قطعة من لوحة فنية .