web.0
  • Home
  • Services
  • Portfolio
  • Blog
  • Contact

SharePoint 2010 branding and development tips and tricks

Posted on April 26, 2011 by web.0

We have been doing a lot of SharePoint 2010 branding and custom development over the last 6 months or so which has kept us both busy, which is good, and away from the blog, which is not ideal. So, we thought the best thing we could do to keep generating something useful for people to read and also help ourselves keep track of all the nuances of SharePoint 2010 development, we’d make a list of as many as possible of the little tips, tricks and hints we have been learning along the way. A sort of cheat sheet. And we’d like to share it, and hopefully get some additional ideas from the community that will help us grow it. So here’s our list so far, with links to relevant articles and posts where things need further explanation. If you have any things you think would be a good addition to the list, we’d love to hear about it, so post us a comment, and the good ones will get added to the list, along with credit of course.

We hope these tricks help, and happy developing!

  1. When designing for intranet sites, it’s best to design for a full width ribbon. A fixed width ribbon with a decent looking scrollbar can be done, but there are so many javascript based changes and updates involved in loading and rendering the ribbon, it can have unintended consequences for certain browser users, so unless your client is desperate for it, you might be able to save them time and cost by suggesting a full width ribbon from the start.
  2. In public facing web sites, don’t even start to load the ribbon in anonymous mode unless you need to, it hugely increases render time. You can do this by only loading the ribbon code and a certain piece of JavaScript in edit mode, or on a user permissions basis using a securitytrimmedcontrol. For more details, see this article
  3. If you are using a full width ribbon and the standard scrollbar, you can achieve a fixed width for the body by using the ‘s4-nosetwidth’ class on the div tag with the ID ‘s4-workspace’, and then applying a fixed width to that div, or by applying a fixed width to the div with the ID ‘s4-bodycontainer’, and leaving it’s parent alone.
  4. The new JavaScript Client Object Model is awesome. And a good way of quickly achieving an interactive web part in an intranet environment, but if you are planning on using it a lot, make sure you read up on request batching. For single list reading, try this method.
  5. The JavaScript Client Object Model get_lists function is restricted when anonymous mode is enabled. Which is a shame. We don’t know what the reason for this is, or the security implications of turning it on, so do this at your own risk, but you can un-restrict  it using a simple powershell command, detailed below.
    In powershell, use the following commands;

    $wa = Get-SPWebApplication http://yourwebappurl
    $wa.ClientCallableSettings.AnonymousRestrictedTypes.Remove([Microsoft.SharePoint.SPList], "GetItems")
    $wa.Update()
    
  6. When using the JavaScript Client Object Model, ensure that the relevant SharePoint core JavaScript file has loaded before calling your function. You can do this by using the built in function ‘ExecuteOrDelayUntilScriptLoaded‘, like so;
    ExecuteOrDelayUntilScriptLoaded(yourfunctioncall, "sp.js");
    
  7. Custom content types do not overwrite their bound versions on lists and libraries when you upgrade your project by adding a field or something. There are manual ways of solving this, or you can use a feature receiver to do the work for you.
  8. Deploying from Visual Studio 2010 using right click > deploy is great and very useful but doesn’t always work the same way as doing a deployment manually using powershell, stsadm, or Central Admin. It is good practice to test your projects using both methods.
  9. A good master page to start from is a great idea.
  10. If you don’t have to load the out of the box sharepoint css and javascript  for your public facing site (I can’t see an intranet not needing them), then don’t, as they can have an impact on page load and rendering times. You can achieve this with the CSS by using security trimmed controls or edit mode panels for your <sharepoint:csslink> tag in the master page, and NOT using the <sharepoint:cssregistration> tag to register your custom CSS file, but a simple html <link> tag instead. The same is true for the javascript, but for the <sharepoint:scriptlink> tag, and if you are using any OOTB web parts, you still need some js stuff to make it all work, see this post for more details.
  11. When creating content in your master page / page layouts that you don’t want picked up by the search index, add the class ‘noindex’ to any divs containing content you don’t want crawled, including ones nested inside divs that already have this class, as it does not inherit.
  12. If you are using right click > deploy in Visual Studio to deploy to sharepoint and you are getting weird errors about values not being able to be null and the like, make sure you close any files you have open in Visual Studio and try again. 9 times out of 10 this fixes the problem. Thanks to Glyn Clough for that little gem.
  13. Having a search core results web part on your home page (say to show the latest 5 items in a list or something like that), can cause the crawler to fail. If you are finding content isn’t being indexed and you have one of these, try removing it temporarily to see if that solves the problem. If it does, there is an update available from the Microsoft web site that fixes the issue.
  14. When creating custom xsl style sheets for things like core search results and content query web parts, there are some handy functions available that have already been made, if you know where to look. Try adding xmlns:srwrt=”http://schemas.microsoft.com/WebParts/v3/searchresults/runtime” to your xsl:stylesheet tag, to allow you to use the GetPlainTextFromHtml function in that schema. It’s great for getting plain text intros in rollups from rich html body content, a regular requirement.

That’s it for now, if you have any to add, let us know!

Share this:
  • Print
  • LinkedIn
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Buzz
  • Google Bookmarks
Posted in General, SharePoint design and development | Tagged AJAX, CSS, Javascript, jQuery | 3 Comments
  • Pingback: SharePoint 2010 branding and development tips and tricks | web.0 … « Zipsite.net

  • http://twitter.com/NickAranz Nick Aranzamendi

    Hi, great stuff in your blog. I’m experiencing problems with my search crawling. I have a search core web part rolling up blogs as you describe in item 14. You mention there is a Microsoft hot fix that solves this problem. Can you share the link with me?

    Thanks

    • http://www.webpoint0.com web.0

      Hi,

      Thanks, glad you like it. I think you should be able to find links to the hotfix you need at this url. http://technet.microsoft.com/en-gb/sharepoint/ff800847.aspx

      I think the update you are looking for is the June one, from what I read at the time.

      Hope that helps!

  • Archive

    Prev Next2012
    • Jan
    • Feb
    • Mar
    • Apr
    • May
    • Jun
    • Jul
    • Aug
    • Sep
    • Oct
    • Nov
    • Dec
  • Tweet
  • Categories

    • SharePoint design and development
    • Magento design and development
    • Javascript, AJAX and jQuery
    • Themes, skins and front ends
    • Custom web development solutions
    • General

all original content © copyright 2011 web.0. all rights reserved.