SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

31
8 – 10 March 2011 | Dubai, UAE

description

By

Transcript of SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

Page 1: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

8 – 10 March 2011 | Dubai, UAE

Page 2: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

8 – 10 March 2011 | Dubai, UAE

Ayman El-Hattab Mohamed YehiaMicrosoft MVP TSP, Microsoft

SharePoint Sandboxed Solutions and InfoPath

SESSION CODE: OSP305

Page 3: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

• Technology Specialist • Contributor Author – SharePoint 2010 Unleashed

Ayman El-Hattab

[email protected]

@aymanelhattab

www.aymanelhattab.com

Page 4: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

• Technology Specialist – Microsoft• SharePoint friend since 2004

Mohamed Yehia

[email protected]

@mohdyehia

www.mohamedyehia.net

facebook.com/mohdyehia

Page 5: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

Agenda

Demo: Order Forms

Developing Sandbox Solutions

Demo: Integrating Sandbox with InfoPath

Summary

Creating Forms with InfoPath 2010

Page 6: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

NEED TO HAVE SHIRTS FOR TECHED SPEAKERS

Page 7: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

What is InfoPath?

Visual Layout

Form Logic

Data Connection

Form Designer & FillerBrowser and Client forms

Page 8: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East
Page 9: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

InfoPath Vs. ASP.NET

Page 10: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

Building Uniform Order FormDemo

Page 11: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

SANDBOX SOLUTIONS

Page 12: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

Outline

• Challenges• What are Sandbox Solutions?• How do they work?• What can I do them Sandbox Solutions?• How can they be managed?

Page 13: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

Challenges• Dev, Admin Fight!

• Change production farm to Full • Memory Leaks• Update web.config files• Bad code that eats up farm resources• Deploy everything to the GAC

• Admins have some control using CAS• Difficult to implement• Difficult to get right

• Largest cause of SharePoint Support cases

Page 14: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

Overview of the Sandbox

• Allows a subset of the full capabilities in the SharePoint API

• Secure – enforcing the sandbox• Execute in a partially trusted environment• Code executes in a special service process• Subject to CAS• Validation framework• Provides way to do custom farm wide validation for the deployed packages

• Each solution is isolated to its site collection

Page 15: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

Sandbox

Sandbox and Code Access SecurityAspNetHostingPermission, Level=MinimalSharePointPermission, ObjectModel=true

SecurityPermission, Flags=Execution

Full Trust

wss_usercode.config

User Code

Framework Code

My.dll

Other.dll System DLL

SharePoint DLL

SharePoint OM

Subset OM

Page 16: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

Sandboxed Solutions Process

Root SPWeb of SPSiteSolution galleryWebParts.wsp

Web Part gallery

Per-WFE AssemblyCache<siteguid>\company.intranet.webpart.wsp\foo.dll

Sandboxed Worker Process

12 5

6

7

4

3

Page 17: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

Sandboxed Solution Lifecycle

Installation• U

pload into Solution Gallery

Activation• A

uto-activates features

Deactivation• I

nert operation, extended by developer

• Web Parts no longer execute

Deletion

Page 18: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

Developing a Sandbox SolutionDemo

Page 19: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

Types of Sandboxed Solutions Sandboxed Solutions Support

• Sandboxed solutions offer developers a subset of the SharePoint API available fully trusted solutions• Site collection and

site scoped Features• Many XML constructs available: Modules, Lists,

ContentTypes, etc.

• Client technologies to access external data – JavaScript, Silverlight etc.

• Offloading resource usage and access handling to client

Non-Visual Web Parts

Event/Feature

Receivers

Feature Activation

Events

Custom Workflow

Actions

InfoPath Forms

ServicesList

DefinitionsCustom Actions

Site Pages

Site Columns

Content Types

Page 20: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

Sandbox Boundaries• No SPSecurity• No SPSite constructor• Off-box connections, http, web services, etc• ADO.net• Enterprise features (Search, BCS, etc.)• Threading• P-Invoke• IO• Other sites

xxxx

xx

x

xx

Page 21: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

SANDBOX RESOURCE MONITORING

Page 22: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

Load Balancing

• Sandboxed solutions can be run in two modes• Local Mode• Execute code on the SharePoint WFE• Low administration overhead• Lower scalability

• Remote Mode• Execution on back-end farm machine• Via dedicated service applications

• Load balanced distribution of code execution requests

Page 23: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

Sandbox Solution MonitoringHow it works• Site collection quotas specify the warning and hard limits for

number of resources that can be used per day• Sum of resource measures are taken across solutions

deployed to site collection• I.e., add up CPU Points for all solutions

• Max of resource utilization measures checked against site collection quota to determine if it should be throttled/blocked

Page 24: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

Monitored ResourcesMetric Name Description Units Resources Per

PointHard Limit

AbnormalProcessTerminationCount Process gets abnormally terminated Count 1 1CPUExecutionTime CPU exception time Seconds 200 60CriticalExceptionCount Critical exception fired Number 10 3

InvocationCount Number of times solution has been invoked Count N/A N/A

PercentProcessorTime Note: # of cores not factored in Percentage Units of Overall Processor Consumed 85 100

ProcessCPUCycles CPU Cycles 1E+11 1E+11ProcessHandleCount Windows Handles 10,000 5,000

ProcessIOBytes (Hard Limit Only) Bytes written to IO Bytes 1E+07 1E+08

ProcessThreadCount Number of Threads in Overall Process Threads 10,000 200

ProcessVirtualBytes (Hard Limit Only) Memory consumed Bytes 1E+09 4E+09

SharePointDatabaseQueryCount SharePoint DB Queries Invoked Number 400 100

SharePointDatabaseQueryTime Amount of time spent waiting for a query to be performed Seconds 20 60

UnhandledExceptionCount Unhanded Exceptions 50 3

UnresponsiveprocessCount We have to kill the process because it has become unresponsive Number 2 1

You can tweak these values to fit your need…

Page 25: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

Sandbox Solution MonitoringCase Study

• A solution has executed 40 SQL queries (via the SharePoint OM)

• One point for SQL is 400 queries• Means for SQL it’s consumed .1 resource points • So the resource usage is for the day for that solution is .1

resource points + other counters

Page 26: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

Sorting Uniform Order FormDemo

Page 27: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

Key Takeaways

• You can build complex forms using InfoPath (Rapid Application Development)

• Consider Sandbox Solutions first• Safe• Monitored• Allow more manageable hosting scenarios

• Quotas are for all sandbox solutions in the site collection• Be creative with your solution design (Use Silverlight + WCF)• InfoPath + Sandboxed Solution Better Together

Page 28: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

Q & A

34

Page 29: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

SharePoint Sandboxed Solutions and InfoPath10 March 2011 09:00 AM - 10:00 AM

Build Compelling Intranets and Extranets with SharePoint 201009 March 2011 11:45 AM - 12:45 PM - Room: Green Room 2

SharePoint 2010 Developer Overview09 March 2011 03:30 PM - 04:30 PM - Room: Green Room 3

35

Related Content

Data-Centric Composites and Mashups in SharePoint 201009 March 2011 09:00 AM - 10:00 AM - Room: Yellow Theatre 2

Page 30: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

8 – 10 March 2011 | Dubai, UAE

Complete an evaluation on CommZone and enter to win a HP Laptop!

Page 31: SharePoint Sandboxed Solutions and InfoPath - TechEd Middle East

© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and

Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.