Archives / 2010 / June
  • SharePoint 2010 Web Parts in Action - 15 chapters

    Tags: SharePoint 2010, SharePoint 2010 Web Parts in Action


    After about six months of writing I have now written a total of 400 pages and 15 chapters about SharePoint 2010 Web Parts for my book called SharePoint 2010 Web Parts in Action. This is a book focusing on Web Part development in SharePoint 2010 and I think that it covers all that is needed for developers who wants to enhance their SharePoint 2010 and Web Parts development skills.

    The chapters are:

    1. Introducing SharePoint 2010 Web Parts
    2. Using and configuring Web Parts in SharePoint 2010
    3. Building Web Parts with Visual Studio 2010
    4. Building the user interface
    5. Making Web Parts customizable
    6. Web Part resources and configuration
    7. Packaging, Deployment and Security
    8. Tools for troubleshooting and logging
    9. Caching for performance
    10. Dynamic interfaces in Web Parts
    11. Client Object Model and Silverlight Web Parts
    12. Making Web Parts Mobile
    13. Web Part design Patterns
    14. Connecting Web Parts
    15. Building Pages and Dashboards

    I have submitted all my chapters to my publisher (Manning) and I am waiting for the final technical review of it before I can let it go (for this time). Once I have reviewed the reviews the book will be sent to typesetting and then it will be on the way to the printers. You will see the book in your closest book shop during this fall.

    But, if you are interested you can actually grab the preview pieces of it right now. Manning has an Early-Access program (MEAP) that allows you to purchase the book right away as a preview e-Book and once the book is hot from the presses it will be sent to you. Head on over to to get your copy. Currently there are the first seven chapters available with two more on the way. If you do get it and you have feedback on it, contact me or discuss it at the Manning Sandbox forums.

    While some really smart guys are doing the review, I'm shutting down for a while for a long awaited vacation. See you on the other side...

    (written using the new Windows Live Writer beta...)

  • SharePoint 2010 Site Definition images must use the correct format

    Tags: SharePoint 2010

    When you create a Site Definition for SharePoint 2010 you should provide an image that illustrates the Site Definition. It allows the users to separate the Site Definitions from each other, find the correct one faster and it looks quite nice!

    In SharePoint 2010 Silverlight is used when selecting Site Actions > New Site. This gives you a nice and fast interface to search for the correct Site Definition. The image of the Site Definition is here very prominent. SharePoint 2007 used a different interface but also used images to represent each Site Definition, but in another way and in another size, so might consider updating them if you are updating your farms.

    Create a Site Definition in Visual Studio 2010

    The Site Definition image is declared in the webtemp_XXX.xml file in the Configuration element using the ImageUrl attribute. When you create a new Blank Site Definition in Visual Studio 2010 your Configuration element will look like this:

        Title="Default Site Def" 
        DisplayCategory="SharePoint Customizations">

    Default Site Definition image Notice the ImageUrl property pointing to the default image. The problem here is that this little property actually has two problems:

    1. It uses a GIF image - which is not supported by the Create Site Silverlight app
    2. It uses an image of the wrong size

    The image, shown to the right, has the size of 307x291 pixels and this size does not fit into the Silverlight application. And the image is of GIF format and that is not supported by the Create Site Silverlight implementation.

    So what should I do?

    Only PNG and JPEG images can be used, so you should create your own image and deploy to the mapped Images folder. Also set the size should be 64x64 pixels to fit into the Silverlight UI. The image below shows how it looks like with four different site definitions; the default image, a GIF image, a JPEG image and a PNG image.

    Site Definitions

    As you can see the GIF images are using a default image instead of the actual GIF image.

    This is a small thing (compared to some other hefty stuff in SharePoint 2010) but for the end-user it really makes a difference and allows them to more easily select the appropriate template.

  • Enhancing the SharePoint 2010 Tag Profile Page with Bing news

    Tags: Web Parts, SharePoint 2010

    The Tag Profile Page in SharePoint 2010 is used by the Managed Metadata Service (MMS) as a landing page for a term or a keyword. It is used to describe the tag, its location in the taxonomy, synonyms etc. It also contains all the latest tagged items and a note board.

    Tag Profile Page

    The page is quite dull out of the box. Fortunately this page is a Web Part Page and can be customized as you like! Get Connected Web PartYou can add Web Parts and rearrange the page. There is not much you can do with the Tag Profile Web Part, but you can edit the Tagged Items Web Part and change how many days it should go back to look for tagged items (default 60 days). The Get Connected Web Part can be slightly configured with what links it will show, see image to the right. And the Noteboard Web Part also has some configuration options such as how many notes to show etc.

    You could add some more out of the box Web Parts if you like but none of them integrates with the current term, not even through Web Part connections.

    Wouldn't it be awesome to connect the tag to an outside service like...let's say Bing News, and see if there are any related news to the tag? Just like below? The image shows the standard RSS Web Part in SharePoint 2010 which is configured to query Bing News for the current term.

    Tag Profile connected to Bing News

    To achieve this I whipped together a small Provider Web Part that takes the term-id from the query string, looks up the value in the term store and then make that tag name available through an IWebPartField connection. This provider Web Part has one property which is used to set the name of the field. That field is then used by the RSS Web Part to create the query string to get the RSS feed. The provider Web Part is configured to be hidden on the page so that it is not seen by the users.

    The code for the Web Part looks like this:

       1:  namespace Wictor.SocialExtensions.SocialTagInfoWebPart {
       2:      [ToolboxItemAttribute(false)]
       3:      public class SocialTagInfoWebPart : WebPart, IWebPartField {
       4:          string socialTagName;
       5:          Guid termId;
       8:          protected override void OnLoad(EventArgs e) {
       9:              try {
      10:                  termId = new Guid(this.Page.Request["termid"]);
      12:              }
      13:              catch (FormatException) {
      14:                  termId = Guid.Empty;
      15:              }
      16:              // get the tag name
      17:              TaxonomySession taxonomySession = new TaxonomySession(SPContext.Current.Site); 
      19:              Term term = taxonomySession.GetTerm(termId);   
      20:              socialTagName = term.Name;
      22:              base.OnLoad(e);
      23:          }
      24:          protected override void RenderContents(HtmlTextWriter writer) {
      25:              writer.Write(string.Format("id:{0}, tag:{1}",termId,socialTagName));
      26:              base.RenderContents(writer);
      27:          }
      29:          [WebBrowsable(true)]
      30:          [Personalizable(PersonalizationScope.Shared)]
      31:          [WebDisplayName("Filter name")]
      32:          public string FilterName {
      33:              get;
      34:              set;
      35:          }
      36:          public void GetFieldValue(FieldCallback callback) {
      37:              callback.Invoke(this.socialTagName);
      38:          }
      40:          public string TagName {
      41:              get {
      42:                  return socialTagName;
      43:              }
      44:          }
      46:          public PropertyDescriptor Schema {
      47:              get {
      48:                  return TypeDescriptor.CreateProperty(this.GetType(), this.FilterName, typeof(string));
      49:              }
      50:          }
      51:          [ConnectionProvider("Social Tag name")]
      52:          public IWebPartField GetConnectionFieldProvider() {
      53:              return this;
      54:          }
      55:      }
      56:  }

    This is a standard Web Part that exposes the IWebPartField interface (line 3) (which the RSS Web Part consumes). In the OnLoad (line 8) method the termid parameter is retrieved from the query string and this is used to lookup the name of the term using the TaxonomySession object (line 17) and stored in the local property socialTagName. The RenderContents (line 24) is used when in editing mode to display the status of the Web Part. The configurable property FilterName (line 32) is exposed so that the editor can change the name of the filter value that is sent to the consumer. For instance the Bing News RSS feed URL expects that the query parameter has the value "Query". The IWebPartField interface requires that the GetFieldValue and Schema methods are implemented. The GetFieldValue invokes the callback with the local property socialTagName and the Schema property returns a PropertyDescriptor of the type string and with the name equal to the FilterName property. Finally the provider connection end-point is configured.

    Configure Connect The TagWhen the Web Part is deployed and feature activated on the My Site Site Collection you can edit the Tag Profile page and add the SocialTagInfoWebPart to the page. Configure it so that it is hidden and set the Filter name property to Query.

    Then add the RSS Web Part to the page. Configure the Web Part, give it a meaningful name like Related on Bing and set the RSS Feed URL to "". This is the URL that will be used to query Bing News.

    To connect the provider Web Part with the RSS Web Part edit the hidden provider Web Part and select Connections > Send Social Tag name To > Related on Bing. In the dialog box select Get Feed Parameter From and click Finish. Then save your page. When the connection is established the RSS Web Part will append the filter name and social tag name to the RSS Feed URL, for instance


    That is all needed to enlighten the Tag Profile Page. A little bit of coding can always sharpen up your SharePoint.

    If you would like to connect it to other RSS sources, just edit the URL in the RSS Web Part and the Filter name in the provider Web Part.

    Note: there are for sure other ways to do this and I bet the SharePoint "no-code" specialists will seconds after this post is available show you how to do it with a little bit of jQuery magic :)

    Until next time...

  • Status of ChartPart for SharePoint 2010

    Tags: SharePoint, Web Parts, CodePlex, SharePoint 2010

    Chart Part

    I have recently been getting quite a few requests and comments about the status of ChartPart for SharePoint - a charting Web Part that I built about a year ago and shared on Codeplex. This latest version have had more than 6.000 downloads which I think is amazing, version 1 had close to 10.000 downloads.

    I temporarily put this project on hold a couple of months a go, due to two major reasons; the built-in Chart Web Part in SharePoint 2010 and that I'm currently writing a book (which essentially means that I have no time at all). Now we now that the out-of-the-box charting Web Part is SharePoint 2010 Server Enterprise only and I only have one and half chapters left on the book.

    So I aim to produce a new and improved ChartPart for SharePoint 2010 as soon as I return from my (well deserved IMHO) vacation.

    If you have any requests, ideas or rants about ChartPart for SharePoint then head on over to the Codeplex site and discuss or submit a feature request.

  • DevSum 2010 presentation about SharePoint 2010 BCS

    Tags: SharePoint 2010, Presentations

    DevSum 2010 is over two days packed with cool sessions. I had the last session of the day and conference but some brave SharePointers showed up and eagerly listened. I hope you enjoyed it and if you need some evening lecture you can download the presentation below, which was about SharePoint 2010 Composites and especially Business Component Services.

    DevSum 2010

    DevSum 2010 had some great content from local gurus and MVPs and the Microsoft Pattern & Practices group was here and shared some valuable knowledge! Thanks Cornerstone for arranging it!

About Wictor...

Wictor Wilén is the Nordic Digital Workplace Lead working at Avanade. Wictor has achieved the Microsoft Certified Architect (MCA) - SharePoint 2010, Microsoft Certified Solutions Master (MCSM) - SharePoint  and Microsoft Certified Master (MCM) - SharePoint 2010 certifications. He has also been awarded Microsoft Most Valuable Professional (MVP) for seven consecutive years.

And a word from our sponsors...