Best Practices Configuring And Developing Share Point Solutions
•Download as PPT, PDF•
7 likes•812 views
This presentation contains best practices from myself and Microsoft regarding configuring and developing SharePoint Solutions. What to do with development, resources, disposing, deployment and some other items.
1 of 34
More Related Content
Best Practices Configuring And Developing Share Point Solutions
2. Introduction Alexander Meijers Architect at Sparked Subject matter Expert for SharePoint and Search http://www.bloggix.com/blogs/microsoft http://www.dutchsug.nl Roel Hans Bethlehem Architect at Sparked Subject matter Expert for SharePoint
3. Agenda Project & tools Keep to the Basics Locations Permissions Development Styling Multilanguage Deployment
4. Setup a development project Create single solution Add for each namespace in your project a class library project Create a namespace for deployment Create a duplicate tree of the 12 Hives Make use of tools like Add in for WSP Builder ( http://www.codeplex.com ) SharePoint installer ( http://www.codeplex.com ) Use features Installing components Changes to config files
5. Tools WSPBuilder Creates SharePoint Solutions files based on a folder structure Deploy solutions SharePoint Installer Creating user friendly installation and deployments for SharePoint 2007 solutions VSeWSS 1.2 Visual Studio 2008 extensions STSDEV Generate Visual Studio project files and solution files STSADM 184 operations through command line on the web server Custom extensions possible
7. Keep to the basics Use standard functionality as much as possible All SharePoint functionality out-of-the-box will still work like search, versioning and publishing Use SharePoint as storage Powerful API model Do not change or replace existing files
8. Master pages, layouts, CSS, images, scripts Into a library inside your site collection Can be referenced by ~site, ~sitecollection and ~masterpage Only available within the site collection Too many site collection makes it harder to update these files Updatable through the web interface Into the _LAYOUTS folder Can be referenced by path to folder Available for every Sharepoint website in farm One place for easy updating these files Only updatable directly on the server All web applications on the server share this folder
9. Code Access Security “ Request for the permission of type Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c failed ”
10. Code Access Security What is it? Security model use by the SharePoint API Ensure your code provides error handling in the event that required permissions are not available Arrange Web applications to operate in a partially trusted environment System.Security. AllowPartiallyTrustedCallersAttribute() Level of trust Full, High, Medium, Low, Minimal Custom like WSS_Minimal, WSS_Medium
11. Code Access Security What are the options? Decorate your code with Request Permissions Declarative Security like [SomePermissionAttribute(SecurityAction.Demand, Unrestricted = true)] Deployment and CAS Trustlevel in your web.config GAC Custom policy file
13. Permissions Who am I? Your code runs with permissions of the logged on user Set up proper testing Especially for anonymous internet facing sites I always use Firefox since it does not log me on Coding & Elevation Impersonation SPSecurity.RunWithElevatedPrivileges
15. Web Part development Do not use any code in your Web Part Always load an UserControl Use the ControlTemplates folder Put the logic into the control Code and design should be separated Put only properties in your Web Part Two namespaces System.Web.UI.WebControls.WebParts Microsoft.SharePoint.WebParts
16. Web Part development Think of Show only accessible / all content Check if content is published or not Recursive reading SPWeb objects UX & Design AJAX Silverlight SharePoint objects like EditorPart & EntityEditorWithPicker
18. Dispose or not to dispose? Two objects in the API model which needs to be disposed of SPSite SPWeb Dispose only when created yourself by SPSite site1 = site2; Use method Dispose() with try, catch, finally or using(…) {…} Do not dispose contextual objects SPContext.Current.Web.Dispose(); Tool SPDisposeCheck
20. Styling, what are the options? CSS stylesheet reference (configurable) Own site definitions, masterpages and templates Separation of layout and content Full control ONET.XML editing Themes Different styles en color schemes for users (only reason to use it!) Testing your theme is terrible Schema files for lists CAML knowledge required Full control of list layout
21. Styling, what are the options? Use Firefox with the “Web developer” add on Easy retrieval of styling Enabling / Disabling certain elements Visualizing your divs and tables Accessibility Out-of-the-box is not conform standards Accessibility Kit for SharePoint http://aks.hisoftware.com/index.html Resources Heather Solomon http://www.heathersolomon.com/ SharePoint Branding Tool http://www.codeplex.com/BrandingTool
23. Multilanguage Variations Is really a copying mechanism Resources files Resource folders Resx files Custom code must support Multilanguage Web Part output Editor Parts Custom forms
24. Resource files Application resources Used within the normal execution of the SharePoint application. Think of Application Pages, Web Parts and Controls For multilangual lists: 12ONFIGesources For local webapplications: <Website URL>pp_GlobalResources Caveat: cannot deploy by WSP package Provisioning resources are used when provisioning elements. Think of features, site definitions and list definitions 12EMPLATEEATURESlt;feature>esourcesesources.<culture>.resx 12EMPLATEEATURESlt;feature>esources 12esources Administrative application resources Used within the normal execution of the SharePoint application. Think of Application Pages, Web Parts and Controls inside the administrative environment 12ONFIGdminResources <Website URL>lt;port>pp_GlobalResources
25. Resource files usage C# HttpContext.GetGlobalResourceObject("MyResource", "MyName").ToString(); ASPX properties <%$Resources:MyResource, MyName%> XML $Resources:MyResource, MyName XML features, using the default resource file $Resources:MyName
26. Demo Using a resources for custom multi language Web Part
27. Solution deployment Deploy the Solution package to the farm Retract the Solutions package When a new web server is added, automatically deploy the solution to it Deploy new versions of the Solution Solution - A CAB file containing Manifest.xml file All the files for the Features, Web Parts, Site or list def changes, etc... that make up your solution
28. Solution deployment “ Featurize” your custom development Any SharePoint element Changes in your web.config Copying files to specific web folders Deploy features and other assets by WSP Solution package
29. Development and testing Your development machine does not go into production Use a buildserver Always test with different set of browsers (level 1 and level 2) Watch out for rights
30. CodePlex The starting point of a lot of new SharePoint functionality Community Kit For SharePoint http://www.codeplex.com/CKS SharePoint learning kit http://www.codeplex.com/SLK SharePoint Features http://www.codeplex.com/features Podcasting kit for SharePoint http://www.codeplex.com/pks Smartpart for SharePoint http://www.codeplex.com/smartpart SharePoint AJAX toolkit http://www.codeplex.com/sharepointajax
31. Resources Best practices resource center for SharePoint 2007 http://technet.microsoft.com/en-us/office/sharepointserver/bb736746.aspx Patterns and practices SharePoint guidance http://www.codeplex.com/spg Best practices for SharePoint guidance http://msdn.microsoft.com/en-us/library/dd203468.aspx SharePoint Deployment Planning Services https://iwsolve.partners.extranet.microsoft.com/SDPS/ Downloadable book: Design and build sites for Office SharePoint Server 2007 http://go.microsoft.com/fwlink/?LinkId=110087 Other resources such as http://www.codeplex.com / http://www.dutchsug.nl / www.microsoft.com/sharepoint
32. Gary Lapointe STSADM http://stsadm.blogspot.com/ Firebug https://addons.mozilla.org/nl/firefox/addon/1843 Yslow https://addons.mozilla.org/nl/firefox/addon/5369 More resources