Know the Unknown When Developing in SharePoint 2010 Derek Sanderson, Mariner Melissa Coates, Intellinet Carolina Code Camp May 14, 2011
About the Speakers Derek Sanderson Lead SharePoint developer at Mariner Specialist in SP,.NET, C#, Web Services, CRM Blog: http://dereksan.blogspot.com Melissa Coates BI developer at Intellinet Specialist in SQL Server SSRS, SSAS, SSIS Blog: http://www.sqlchick.com Twitter: @sqlchick
Overview of Session This session is based upon things we have learned & dealt with during two BI-oriented SharePoint 2010 implementations late 2010-early 2011. One implementation: SharePoint Foundation on a public facing site The other: SharePoint Enterprise on an internally authenticated site
Agenda Figuring out Unexpected Errors Web Config Updates Using SPDiagnosticsCategory to Write to the ULS Log Web Part Maintenance Page Development Environment Developer Dashboard PowerShell for deployment Choosing Technologies Dashboards, Scorecards, Reports SSRS Native Mode vs. SharePoint Integrated Mode PowerPoint for Quick Branding Dealing with Limitations Performance Issues with Report Viewer Control 10 Foundation Limitations Q&A
Unexpected Errors
Unexpected Error Default unexpected error display:
Web Config Updates c:\inetpub\wwwroot\wss\virtualdirectories\80\web.config CustomErrors CallStack (SafeMode node) Debug (Compilation node) Dev Only!
Errors Displayed CustomErrors = on CallStack = true Debug = true
Errors Displayed (cont d) CustomErrors = off CallStack = true Debug = true
Searching the ULS Log %ProgramFiles%\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS Finding error by correlation ID can be tedious; Requires searching each WFE s log
SPDiagnostics Category
Using SPDiagnosticsCategory to Write to the ULS Log Much easier in 2010 to write to ULS logs using the SPDiagnosticsService class
Using SPDiagnosticsCategory to Write to the ULS Log (cont d) Search ULS log by your custom category name
ULS Viewers http://ulsviewer.codeplex.com/
ULS Viewers (cont d) http://archive.msdn.microsoft.com/ulsviewer Allows for real time logging.
Web Part Maintenance Page
Deleting a Web Part When Page is Erroring Out We lose the link if we suppress the default unexpected error page with our Web.Config settings
Deleting a Web Part When Page is Erroring Out Add query string parameter?contents=1 to access Web part Maintenance If the URL of the page already has existing query string parameters: Use &contents=1 instead of?contents=1
Web Part Maintenance Page
Remote SSRS Errors
Remote SSRS Errors To enable Remote Errors in SQL Server Mgmt Studio:
Developer Dashboard
Developer Dashboard New in 2010 to troubleshoot page rendering time. Off by default.
Developer Dashboard (cont d)
Developer Dashboard (cont d) 3 Ways to Enable the Developer Dashboard: PowerShell, STSADM, or Object Model 3 Options: On Off On Demand provides an icon to toggle the view Farm-Wide Setting
Developer Dashboard (cont d) Controlling who sees the Developer Dashboard: One option: Group which controls who sees the output: SPDeveloperDashboardSettings.RequiredPermissions Another option: 1. Enable On Demand 2. Remove icon in the master page 3. Access it by appending query parameter: http://www.mysharepointsite/default.aspx?developerdashboard=true
Developer Dashboard (cont d) Using PowerShell to Enable the Developer Dashboard: $DevDashboardSettings = [Microsoft.SharePoint.Administration.SPWebService]::ContentSer vice.developerdashboardsettings; $DevDashboardSettings.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel ]::OnDemand; $DevDashboardSettings.RequiredPermissions = 'EmptyMask'; $DevDashboardSettings.TraceEnabled = $true; $DevDashboardSettings.Update(); (Get-SPFarm).PerformanceMonitor.DeveloperDashboardLevel = OnDemand
Developer Dashboard (cont d) Using STSADM to Enable the Developer Dashboard: STSADM o setproperty pn developer-dashboard pv OnDemand
Developer Dashboard (cont d) Adding custom code to the event pipeline: Utilize SPMonitoredScope to monitor custom code in Developer Dashboard: Execution time Number of SPRequests Number of SQL Queries (incl. query text) using Microsoft.SharePoint.Utilities; using (SPMonitoredScope monitoredscope = new SPMonitoredScope( Custom Web Service Call )) { mywebservicecall(); } Limitation: Won t capture code from a Sandboxed component (User Solution).
Developer Dashboard (cont d) Adding Developer Dashboard to a custom master page: <Sharepoint:DeveloperDashboardLauncher ID="DeveloperDashboardLauncher" NavigateUrl="javascript:ToggleDeveloperDashboard()" runat="server" ImageUrl="/_layouts/images/fgimg.png" Text="<%$Resources:wss,multipages_launchdevdashalt_text%>" OffsetX=0 OffsetY=78 Height=16 Width=16 /> <div id="developerdashboard" class="ms-developerdashboard" /> <SharePoint:DeveloperDashboard runat="server" />
Developer Dashboard (cont d) CodePlex project to extend the Developer Dashboard: http://devdashvis.codeplex.com/
PowerShell for Deployment
PowerShell for Deployment Dev > QA > Prod Site Collection Backup Site Collection Restore Restoring permissions on different domain Setting primary & secondary site collection admins
PowerShell for Deployment (con td)
PowerShell for Deployment (con td) This script asks to proceed before each step. Facilitates doing multiple things within a single script. Typically used to establish proper permissions.
PowerShell for Deployment (con td) Invoke script to restore a site collection backup: Console Display: y performs restore / n skips / *ctrl]-c aborts *enter+ performs default action (which is y )
Choosing Technologies
Dashboards, Scorecards, Reports
Dashboards, Scorecards, Reports BI Tool Especially Good At SharePoint Edition Required Excel Pivot tables using SSAS cube Any Excel Services Hiding or simplifying an Excel workbook; server processing Enterprise PowerPivot Power User Ad-Hoc Enterprise PerformancePoint Services (incl. Decomposition Tree) Interactivity (SSAS drilldown to more detail) Enterprise (incl. Silverlight for Decomp) Report Builder End User Ad-Hoc Any (SQL Server) SharePoint Charts Simple requirements Enterprise SharePoint Dashboards SharePoint KPIs SQL Server Reporting Services Parameterized reports; printable reports Visio Services Data-driven diagrams Enterprise Any (Native or Integrated Mode)
Wiki Pages for System Documentation Wiki pages are a great option for creating a knowledgebase for users System / Security / Login info Help and FAQs How To Run reports Enter data into lists the possibilities here are endless Consider making the wiki page data-driven Ex: documentation for how to understand a Key Performance Indicator store its URL within DB along with the value, status, trend data
Master Data Services New in SQL Server 2008 R2 (Stratature acquisition) Great for handling hierarchies of data, or additional attributes not in the source system
SSRS: Native vs. SP Integrated Mode User Interface: Native Mode Report Manager -or- Report Viewer Control Web Part Integrated Mode SharePoint Document Libraries & Report Viewer Control (RVC) Web Part SP Edition: N/A Can use any Edition (more features with Enterprise Edition) Security: 2 nd layer of security in Report Manager folders Reports:.rdl.rdl Integrated w/ SP security Data Sources:.rds.rsds (different format) Limitations: -Separate site for users -Separate security model -Report Manager not very customizable -No Linked Reports
PowerPoint for Quick Branding
PowerPoint for Quick Branding Goals: Avoid time-consuming CSS and master page edits Permit business users to be involved 20 predefined themes available in SP 2010 36 predefined themes available in PPT 2010 Customized themes in PowerPoint Easy Fully customized colors: iterative No themes for anonymous users
PowerPoint for Quick Branding (cont d) Step 1. Create in PowerPoint.
PowerPoint for Quick Branding (cont d) Step 2. Export from PowerPoint.
PowerPoint for Quick Branding (cont d) Step 3. Upload into SharePoint.
PowerPoint for Quick Branding (cont d) Step 4. Apply Theme within SharePoint.
PowerPoint for Quick Branding (cont d) Cross-referencing color selections in SharePoint:
Dealing with Limitations
SSRS: Report Viewer Web Part 9 vs 10 An expected ~1 second additional overhead (due to API calls between SSRS and SP) Known performance issue with RVC 10: embedding charts/gauges/maps within a Tablix performs filling which is costly. RVC 9 does not support new SSRS 2008 R2 features (such as indicators, sparklines, maps). 7-10 seconds after user clicks the +/- sign to show 3 rows of data
SharePoint Foundation Limitations Limitations which affected our implementation: No enhanced Web Analytics. Alternatives: Google Analytics SSRS Execution Log Reporting Insert shameless plug for 2pm session! No Audience Targeting. Workarounds: Place authenticated items in different site Security trimming (SPSecurityTrimmedControl which uses base Sharepoint permissions)
SharePoint Foundation Limitations (cont d) No Themes for Anonymous Users. Workaround: Ribbon is displayed for anonymous users. Workaround: Security trimming (SPSecurityTrimmedControl which uses base Sharepoint permissions) No I Like It Social Bookmarks. Workarounds: Facebook Like Google +1
SharePoint Foundation Limitations (cont d) ActiveX prompt on anonymous sites (IE). Resolution: Set Person Name Actions and Presence Settings to No.
Q&A
References SharePoint Editions http://sharepoint.microsoft.com/en-us/buy/pages/editions- Comparison.aspx Features Supported by SSRS in Integrated Mode http://msdn.microsoft.com/en-us/library/bb326290.aspx SSRS Performance in SP Integrated Mode SQL Server 2008 R2 http://sqlcat.com/technicalnotes/archive/2010/11/03/reportin g-services-performance-in-sharepoint-integrated-mode-in-sqlserver-2008-r2.aspx
References (cont d) Using Developer Dashboard http://msdn.microsoft.com/en-us/library/ff512745.aspx Using SP Monitored Scope: http://msdn.microsoft.com/en-us/library/ff512758.aspx
Thanks for attending! Derek Sanderson Blog: http://dereksan.blogspot.com Slides posted on the Presentations page Melissa Coates Blog: http://www.sqlchick.com Twitter: @sqlchick Creative Commons License: Attribution-NonCommercial-NoDerivative Works 3.0