Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Hdv309 - Real World Sandboxed Solutions


Published on

Published in: Technology, Business
  • Be the first to comment

Hdv309 - Real World Sandboxed Solutions

  1. 1. This session runs on code available at Real World Sandboxed Solutions Wouter van
  2. 2. What you will learn• The right approach to sandbox development• The intricacies of the sandbox – Choice of Client or server side code – Limits in the available APIs – Known issues
  3. 3. What you will get• Visit Visual Studio 2010
  4. 4. From 0 to 100Setup a Visual Studio projectBuild the feature structureDefine the web templateMake it locally installableStructure the dataAdd chromeApply business logic...
  5. 5. 1) New project
  6. 6. 2) Define activation structure Web Template Template Feature Site Web Feature Feature• Root Features visible• Activation dependencies for ordering of content activation ... Core Lists• Web template for one click activation of a new site• Web template for declarative configuration ... ... • Masterpage • CSS • Script
  7. 7. 3) Local installation• Load SharePoint Snapin• Build the project with MSBuild• Delete the old test site collection• Create a new test site collection• Upload the solution package• Activate the solution package• Apply the site template• Install sample data
  8. 8. 4) Defining the data structure Fields Content Types List Templates Lists• Lookup fields can be created declaratively• Content Type Inherits attribute works differently in sandbox• <ContentTypeRef> in list templates will not work
  9. 9. 5) Applying chrome Master Page CSS Images XSL
  10. 10. 6) Create business logic Client Server
  11. 11. 7) Provisioning JQuery<script src="//"></script><script>window.jQuery || document.write(<script src=" + demoUrlCombine(_spPageContextInfo.webServerRelativeUrl, jquery-1.7.2.min.js) + "></script>)</script><script type="text/javascript"> var $j = jQuery.noConflict(); $j(document).ready(function () { SP.SOD.registerSod(demosite.js, demoUrlCombine(_spPageContextInfo.webServerRelativeUrl, demosite.js)); SP.SOD.registerSodDep(demosite.js, ribbon); SP.SOD.executeFunc(demosite.js, DemoSite, function () { DemoSite.initializePage(); }); });</script>
  12. 12. 8) Provisiong custom Web Parts<AllUsersWebPart WebPartZoneID="Right" WebPartOrder="1"><![CDATA[ <webParts> <webPart xmlns=""> <metaData> <type name="SPConnections.SandboxingDemo.WebParts.DemoPart.DemoPart…" /> <importErrorMessage>$Resources:core,ImportErrorMessage;</importErrorMessage> <Solution xmlns="" SolutionId="22a17cf7-692a-4a73-8001-dea59b9ee9f4" /> </metaData> </webPart> </webParts>]]></AllUsersWebPart>
  13. 13. 9) Provision custom views<AllUsersWebPart WebPartZoneID="Right" WebPartOrder="2"><![CDATA[ <webParts> <webPart xmlns=""> <metaData> <type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart, Microsoft.SharePoint, ..." /> <importErrorMessage>$Resources:core,ImportErrorMessage;</importErrorMessage> </metaData> <data> <properties> <property name="Title" type="string">Default Web Part</property> <property name="ListName" type="string">$ListId:DemoPages;</property> <property name="XslLink" type="string">Style Library/DemoSite.xsl</property> </properties> </data> </webPart> </webParts>]]></AllUsersWebPart>
  14. 14. 10) Provision connections<View ID="{088ca4b1-e4f3-4f0f-8904-0943b30b696f}" List="ParentItems" BaseViewID="1" WebPartZoneID="Left" WebPartOrder="1" /><View ID="{5df7d5a6-9637-472a-b793-0fd7ee560c8a}" List="ChildItems" BaseViewID="1" WebPartZoneID="Left" WebPartOrder="2“ /><WebPartConnection ID="MyConnection" ProviderID="{088ca4b1-e4f3-4f0f-8904-0943b30b696f}" ProviderConnectionPointID="DFWP Row Provider ID" ConsumerID="{5df7d5a6-9637-472a-b793-0fd7ee560c8a}" ConsumerConnectionPointID="DFWP Filter Consumer ID"> <WebPartTransformer Assembly="Microsoft.SharePoint, Version=, Culture=neutral, ..." Namespace="Microsoft.SharePoint.WebPartPages"> <![CDATA[<WebPartPages:SPRowToParametersTransformer ProviderFieldNames="Title" ConsumerFieldNames="ParentItem"/>]]> </WebPartTransformer></WebPartConnection>
  15. 15. Your Feedback is Important Please fill out a session evaluation form drop it off at the conference registration desk. Thank you!