Hdv309 - Real World Sandboxed Solutions

1,408 views

Published on

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,408
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Hdv309 - Real World Sandboxed Solutions

  1. 1. This session runs on code available at http://bit.ly/SC12Sandbox Real World Sandboxed Solutions Wouter van Vugtwouter@code-counsel.net@woutervugthttp://woutersdemos.codeplex.comhttp://blogs.code-counsel.net/wouter
  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 http://bit.ly/SC12Sandbox 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="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></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="http://schemas.microsoft.com/WebPart/v3"> <metaData> <type name="SPConnections.SandboxingDemo.WebParts.DemoPart.DemoPart…" /> <importErrorMessage>$Resources:core,ImportErrorMessage;</importErrorMessage> <Solution xmlns="http://schemas.microsoft.com/sharepoint/" 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="http://schemas.microsoft.com/WebPart/v3"> <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=14.0.0.0, 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!

×