2. About Me
Independent SharePoint Consultant - Obilogic Ltd
(a SharePoint ‘All Hat’)
Working with SharePoint since Portal Server 2001
(10 years+)
MCITP / MCTS SharePoint 2010
Blog: http://community.obilogic.co.uk
Twitter: @obilogic
Email: aobi@obilogic.co.uk
3. Agenda
Querying BCS Data via SharePoint :
Fundamentals
Approaches
Searching BCS Data via SharePoint:
Fundamentals
Approaches
Title Fight: Query vs. Search
Questions (and hopefully Answers)
4. The Challenge
Identify the best approach for retrieving and
displaying external data in SharePoint 2010
Based on:
Practicality
Flexibility
Scalability
General Awesomeness!!! (Title Fight!)
5. Environment
TWO-TIER FARM • SharePoint 2010 (sp1 + Feb2012 cu)
• BCS Service Application
• Secure Store Service Application
• SharePoint Designer 2010
• SQL 2008 R2 (x2 instances)
• All SharePoint Databases
• Adventure Works 2008 R2 Sample DBs
http://social.technet.microsoft.com/wiki/contents/
articles/3735.sql-server-samples-readme-en-
us.aspx#Readme_TOC_worknow
8. So…Query vs. Search
What’s the difference?
In a nutshell:
SPQuery
(Microsoft.SharePoint.SPQuery)
VS.
KeywordQuery
(Microsoft.office.Server.Search.Query.KeywordQuery)
10. #SPQuery (Microsoft.SharePoint.SPQuery)
# get the splist (external list)
$spList = $web.Lists["AdvWorks-Person"]
# set the spquery (+ some properties)
$spQuery = new-object Microsoft.SharePoint.SPQuery
$camlQuery =
"<Where>
<Eq>
<FieldRef Name='LastName' />
<Value Type='Text'>Troyer</Value>
</Eq>
</Where>"
$spQuery.Query = $camlQuery
$spQuery.RowLimit = 10
# issue the query
$spListItemCollection = $spList.GetItems($spQuery)
11. #SP Search (Search.Query.KeywordQuery)
# setup a keyword query object
$site = New-Object Microsoft.SharePoint.SPSite https://sp2010test;
$kq = New-Object Microsoft.office.Server.Search.Query.KeywordQuery $site;
# set the keyword query (+ some properties)
$kq.QueryText = "Troyer";
$kq.ResultTypes =
[Microsoft.Office.Server.Search.Query.ResultType]::RelevantResults;
$kq.RowLimit = 5;
$kq.ResultsProvider =
[Microsoft.Office.Server.Search.Query.SearchProvider]::SharepointSearch;
#alternatives ::FASTSearch or ::Default
# issue the search
$resultTableCollection = $kq.Execute();
12. SPQuery: Dataflow
SharePoint BCS
API External List •Secure Store
(PowerShell)
Database:
AdventureWorks2008R2
Table Name:
Person.Person
User
SharePoint BCS
API External List •Secure Store
(PowerShell)
13. SP Search: Dataflow
SharePoint API
SP Search Mapped ‘Crawl’ and
(PowerShell) ‘Managed’ Properties
SP Search Databases: BCS
CrawlDB
•Secure Store
PropertyDB
SearchServAppDB
User Full / Incremental
SharePoint Crawls (Scheduled)
API SP Search
(PowerShell) Database:
AdventureWorks2008R2
Table Name:
Person.Person
17. SPQuery:
Filters Aren’t As Good As They Seem
How u might think they work:
SharePoint Filter BCS
External List •Secure Store
Presentation WebParts
Database:
AdventureWorks2008R2
Table Name:
User Person.Person
SharePoint BCS
External List •Secure Store
Presentation
18. SPQuery:
Filters Aren’t As Good As They Seem
How they ACTUALLY work:
SharePoint BCS
External List
Presentation •Secure Store
Database:
AdventureWorks2008R2
Table Name:
User Person.Person
SharePoint Filter BCS
External List •Secure Store
Presentation WebParts
31. SPQuery: Weigh In
Pros Cons
Practicality Flexibility Scalability Practicality Flexibility Scalability
Crawls + Searches any Easily Create Available in Missing SPList XSLTViewWP
supported external Multiple Views SP Foundation Features (no RSS, restricted to current
content source (SPLIst / SPDesigner) (NO Enterprise Excel, Add column, SPWeb
License Req’d) data sheet views, (guid restriction)
item permissions
Multiple (Ext)SPLists Multiple Custom x2 Levels Requires an SPList May need to grant
From single / multiple SPViews available to unnecessary
ECT(s) – across multiple across single / Add /Restrict permissions on ECT
sites / site collections multiple (Ext) SPLists Permissions (if x2 SPLists share x1
(SPList / ECT) ECT)
Real Time Queries to Perform ‘True” SPQuery Deploying Custom Performance???
External Datasource (using parameters)
XSLTViewWP arts Lots of real-time
(Knock Out Punch!) through dev lifecycle queries of ‘large data
(dev, test, prod) sources’
32. SP Search: Weigh In
Pros Cons
Practicality Flexibility Scalability Practicality Flexibility Scalability
Crawls + Searches any All Search Features Very Scalable ! Default results Difficult customising NOT Available in
supported external available (RSS, (Search Service display NOT very (XSLT only – NO SP Foundation
content source alerts etc) App Architecture) user friendly SPList Config UI) (Enterprise License
IS Required)
Does NOT need SPList Only need to grant Can give users Content Sources Advance planning
(Only ECT) ECT permissions to search access determined by ECT required
DefaultCrawlAcc without granting “data source name” (if want to separate
access to (NOT ECT name) multiple tables from
underlying ECT same datasource)
Schedule when data is Perform ‘Custom” Can get around Queries to
“Crawled” Data Queries BCS Throttle limit
External Datasource
using “LastIdSeen”
(Extracted) (using custom ECT and IDEnumerator
NOT REAL TIME
- eg. Overnight parameters) methods
(Knock Out Punch!) (Knock Out Punch!)