Best Practices and Avoiding Common Errors with SharePoint Development<br />Ivan Sanders<br />SharePoint Architect<br />Mic...
Topics<br />Data access<br />Site objects<br />Cross-site objects<br />Data aggregation<br />SharePoint trivia<br />Questi...
Data Access<br />Site Objects<br />
SharePoint Lists<br />List data is stored in single UserInfo table for each content database<br />List constructs are virt...
SharePoint Lists<br />
Data Retrieval<br />Use an indexer to return a single list item from the collection<br />
Data Retrieval<br />Use an indexer to return a single list item from the collection<br />
Data Retrieval<br />Looping operations in the object model are very resource intensive<br />
Data Retrieval<br />Design architecture to support application requirements<br />Use CAML queries for targeted item select...
Data Presentation<br />2000 item limit guideline applies only to built-in list views NOT to list contents<br />Extremely l...
Web Services<br />Provide front-end for OM code<br />Return list objects as XML<br />Manipulating XML in memory is more ef...
Web Services<br />SharePoint Emoticons (My Fav)<br />0;#  <br />SP sticking its tongue out  (:-P)<br />X0020<br />This_x00...
Demo<br />Using SharePoint Lists as a Data Source<br />
Data Access<br />Cross-Site Objects<br />
CAML<br />No native cross-site functionality<br />Combine with recursive methods to create consolidated dataset<br />Recur...
PortalSiteMapProvider<br />MOSS only<br />Optimized for repeated calls to same set of objects<br />Use the GetCachedListIt...
Search<br />Provides non-contextual item data within defined scope(s)<br />Requires parsing potentially large number of re...
Web Services<br />Some methods provide multiple object support (lists, Webs, etc.)<br />Results are non-contextual; howeve...
Demo<br />Retrieving SharePoint List Items from Multiple Site Collections using MOSS Search<br />
Data Aggregation<br />
Relational Data <br />SharePoint lists are inherently non-relational <br />Structure in Lists table<br />Data in UserInfo ...
ADO.NET<br />Define list structures and primary/foreign keys<br />Remember data type limitations<br />Retrieve list object...
LINQ<br />Simplifies programming<br />Allows for normalized query language similar to T-SQL<br />Performance impact is dic...
Recursive Site Queries<br />Avoid direct database queries<br />Create Timer Job or Windows Service to execute recursion co...
Best Practices<br />Site Objects – Use CAML to retrieve list objects<br />Create custom web parts to display large dataset...
SharePoint Trivia<br />
Round 1:<br />Lists are limited to 1,000,000 individual items<br />
Round 2:<br />You may omit the “ows_” prefix from field names in Object Model CAML queries<br />
Round 3:<br />Web services are more efficient at retrieving large datasets than CAML<br />
Round 4:<br />Executing a Full Text SQL Query against the search API returns a ResultTable object<br />
Round 5:<br />Using SPList.GetListAsDataTable() returns XML Encoded results<br />
Q & A<br />
Resources<br />
Resources<br />SharePoint 2007 Performance and Scalability White Paper<br />http://blogs.msdn.com/sharepoint/archive/2008/...
Upcoming SlideShare
Loading in …5
×

Ep development best practices v.06

534 views
480 views

Published on

Best Practices and Avoiding Common Errors with SharePoint Development

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
534
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Ep development best practices v.06

  1. 1. Best Practices and Avoiding Common Errors with SharePoint Development<br />Ivan Sanders<br />SharePoint Architect<br />Microsoft SharePoint Server MVPDimension Solutions inc.<br />ivan@dimension-si.com<br />
  2. 2. Topics<br />Data access<br />Site objects<br />Cross-site objects<br />Data aggregation<br />SharePoint trivia<br />Questions and Answers<br />
  3. 3. Data Access<br />Site Objects<br />
  4. 4. SharePoint Lists<br />List data is stored in single UserInfo table for each content database<br />List constructs are virtualized and non-relational (but you can create relationships programmatically)<br />Lists are optimized for UI not for transactional data access<br />Limited data types and data type instances<br />
  5. 5. SharePoint Lists<br />
  6. 6. Data Retrieval<br />Use an indexer to return a single list item from the collection<br />
  7. 7. Data Retrieval<br />Use an indexer to return a single list item from the collection<br />
  8. 8. Data Retrieval<br />Looping operations in the object model are very resource intensive<br />
  9. 9. Data Retrieval<br />Design architecture to support application requirements<br />Use CAML queries for targeted item selection<br />Maintain SQL indexes for optimal query execution<br />Manipulate item data using in-memory objects (SPListItemCollection, DataTable, <List>, XML)<br />For extremely large data sets, segment data across multiple content databases<br />
  10. 10. Data Presentation<br />2000 item limit guideline applies only to built-in list views NOT to list contents<br />Extremely large list structures (10,000+ items) require custom web parts to display content<br />Data-bound objects provide best performance<br />XML + XSLT outperforms list view objects<br />Page results to reduce rendering times<br />Beware caching of large data sets in ViewState<br />
  11. 11. Web Services<br />Provide front-end for OM code<br />Return list objects as XML<br />Manipulating XML in memory is more efficient than repeated calls OM<br />Require extensive text manipulation<br />Beware column name differences and content formatting<br />
  12. 12. Web Services<br />SharePoint Emoticons (My Fav)<br />0;# <br />SP sticking its tongue out (:-P)<br />X0020<br />This_x0020_is_x0020_My_x0020_Favorite<br />ows_<br />All Your Fields Are Belong to OWS<br />-1001<br />Look! Booleans can be anything!<br />
  13. 13. Demo<br />Using SharePoint Lists as a Data Source<br />
  14. 14. Data Access<br />Cross-Site Objects<br />
  15. 15. CAML<br />No native cross-site functionality<br />Combine with recursive methods to create consolidated dataset<br />Recurse list of site and list objects (XML, Delimited, GetSubwebsForCurrentUser, etc.)<br />Store list items in ADO.NET object (DataTable, DataSet, etc.)<br />Be aware of memory issues when using SPQuery to retrieve very large datasets<br />
  16. 16. PortalSiteMapProvider<br />MOSS only<br />Optimized for repeated calls to same set of objects<br />Use the GetCachedListItemsByQuery() method for cacheable items that do not change often<br />Executes CAML Query without having to walk the collection of SPWeb objects<br />List items must still be iterated using in-memory methods<br />
  17. 17. Search<br />Provides non-contextual item data within defined scope(s)<br />Requires parsing potentially large number of results (XML or ResultTable)<br />Scopes and queries must be managed to return desired results – no guarantee that default results will include the desired item(s)<br />Access to contextual item data requires recursive object methods<br />
  18. 18. Web Services<br />Some methods provide multiple object support (lists, Webs, etc.)<br />Results are non-contextual; however, most metadata is available in native methods<br />Resultant XML must be parsed and manipulated<br />XML may be consolidated and XPATH used in place of recursion<br />Extensive/repetitive calls increase overhead on WFEs<br />
  19. 19. Demo<br />Retrieving SharePoint List Items from Multiple Site Collections using MOSS Search<br />
  20. 20. Data Aggregation<br />
  21. 21. Relational Data <br />SharePoint lists are inherently non-relational <br />Structure in Lists table<br />Data in UserInfo table<br />Fixed number of field elements<br />Relationships must be created programmatically using combination of list definitions and ADO.NET, LINQ, etc.<br />
  22. 22. ADO.NET<br />Define list structures and primary/foreign keys<br />Remember data type limitations<br />Retrieve list objects via OM or Web Services<br />Create relational DataSet objects, merge into single DataTable<br />Use stand-beside DB for caching and native SQL queries<br />
  23. 23. LINQ<br />Simplifies programming<br />Allows for normalized query language similar to T-SQL<br />Performance impact is dictated by type of operation<br />Lists expose XML which can be directly queried<br />
  24. 24. Recursive Site Queries<br />Avoid direct database queries<br />Create Timer Job or Windows Service to execute recursion code<br />Schedule for off-peak hours<br />Store results in separate database<br />Query against custom DB<br />Batch bulk update tasks using Web services<br />Avoid populating data warehouse via event handlers<br />
  25. 25. Best Practices<br />Site Objects – Use CAML to retrieve list objects<br />Create custom web parts to display large datasets<br />Cross-Site Objects – PortalSiteMapProvider and Search provide optimal performance<br />External Objects<br />SP to SP – Use web services<br />Other – Employ least overhead-intensive method<br />Data Aggregation – Relational list methods should be reserved for smaller datasets<br />
  26. 26. SharePoint Trivia<br />
  27. 27. Round 1:<br />Lists are limited to 1,000,000 individual items<br />
  28. 28. Round 2:<br />You may omit the “ows_” prefix from field names in Object Model CAML queries<br />
  29. 29. Round 3:<br />Web services are more efficient at retrieving large datasets than CAML<br />
  30. 30. Round 4:<br />Executing a Full Text SQL Query against the search API returns a ResultTable object<br />
  31. 31. Round 5:<br />Using SPList.GetListAsDataTable() returns XML Encoded results<br />
  32. 32. Q & A<br />
  33. 33. Resources<br />
  34. 34. Resources<br />SharePoint 2007 Performance and Scalability White Paper<br />http://blogs.msdn.com/sharepoint/archive/2008/06/17/belated-announcement-sharepoint-server-2007-scalability-and-performance-whitepaper-now-available.aspx<br />Patterns and Practices Guidance<br />http://www.codeplex.com/spg<br />

×