in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

Tobias Zimmergren's thoughts on development - MOVED!

THIS BLOG HAS MOVED!!!
NEW URL: www.zimmergren.net
Please update your RSS and bookmarks!

Any comments here will not be answered, please comment on http://www.zimmergren.net instead!
All the same posts are there
  • BLOG MOVED: Please update your feeds and bookmarks! :)

    I've moved my blog to http://www.zimmergren.net

    Please update your feeds and bookmarks,

    Thanks!

    Tobias Zimmergren

  • Silverlight 1.0 seamless integration with SharePoint 2007 complete!

    Author: Tobias Zimmergren
    Url:
    http://www.sharepointblogs.com/zimmer

    Yep. It's me again...

    I managed to salvage most of the data from the bluescreen a couple of hours earlier (due to the persistent use of source control).

    I'll cover this topic more in details in one of the days to come, for now - this is what it looks like:

    Please do comment!

    Have a good night everybody! I sure will, now.

  • Bluescreen of Death on my VPC - Setting me back a bit with the tutorial on integrating Silverlight 1.0 seamlessly with SharePoint 2007

    I completed my integration project with Silverlight 1.0 and SharePoint 2007 - which doesn't requiry any configuration on your server, except to install my Web Part with the .wsp solution.

    But...

    Instead of giving you a nice guide on how to implement and integrate Silverlight, Microsoft gave me a Bluescreen of Death smacked in my face when I was copying my files to the source control environment.

    Anyhow, it's not such a big loss. I think most of the things are checked into the Source Control environment already, so i just need to set up a new VPC - seeing as this one doesn't even start anymore :S

    Hang in there a few days and you'll have your Silverlight 1.0 integration served on a Silverplate!

    Keep in touch.

  • SharePoint Cross List Queries in a custom UserControl

    Author: Tobias Zimmergren
    Url:
    http://www.sharepointblogs.com/zimmer

    I got the question last week weather it's possible to get items from all lists of <your chosen type here> gathered and displayed on one page.
    This is - like most things - possible in SharePoint without any greater efforts. With something called Queries we can use the object model to query SharePoint and get a result quite painlessly.

    To demonstrate a very simple example, I've created a very small usercontrol (for use with Jan Tielen's SmartPart) that looks like this:

    This code will combine all the items in all of the TaskLists on the current SiteCollection and display them in a simple GridView as seen above in the screenshot.

    Code for the Cross List Query UserControl

    Simple enough, huh?
    Of course you can create webparts, usercontrols, application pages, or any other type of application to interact with the object model in this way. I chose to do it using a UserControl for the ease of deployment, testing, development and demonstration.

    For your conveniance I've uploaded the UserControl (.zip) here so you can download it.

  • Silverlight (2.0) Blueprints for SharePoint

    Author: Tobias Zimmergren
    Url:
    http://www.sharepointblogs.com/zimmer

    Hi people, been really busy the last couple of weeks and havn't had the time to answer your mails nor write any new blogposts.

    However, I just felt that I needed to get this link out there for you guys to check out in case you havn't already: http://www.ssblueprints.net/sharepoint/

    "Open Source Source Code and Full Blueprint coming soon" - Sounds promising

    While you check out that link, I'll try to figure out the topic of my next MOSS post ;)

  • Windows Live Alerts - Now on your blog or website

    Author: Tobias Zimmergren
    Url:
    http://www.sharepointblogs.com/zimmer

    I just read a post by Michael Gannotti which was about the new features from Windows Live. Now you can use Alerts on your blog/website so people can register/sign up to receive alerts when you make changes or adds new posts to your blog.

    Read more on Michael's blog here

  • Get a Web based Windows Live Messenger application on your blog or website

    Author: Tobias Zimmergren
    Url:
    http://www.sharepointblogs.com/zimmer

    Short post! I just bumped into this feature of the Windows Live Messenger application which enables you to actually add a web-based messenger to your site or blog.

    Check out http://settings.messenger.live.com/applications/websettings.aspx to create one for yourself.

     

    First off, click the little green MSN-guy (it's green if the person is online)

     

    You'll get some dialogs asking you for either your Live Passport or if you'd like to be anonymous and then you need to enter a verification code. After that, you'll see the dialog below in a browser window, being able to chat with the person. If I'm online, you can try it out!

  • MOSS 2007: Creating a custom AJAX UserControl that will query the SharePoint Search Query Object Model to perform searches

    Author: Tobias Zimmergren
    Url:
    http://www.sharepointblogs.com/zimmer

    If you've read my last two blogposts you already know how to configure ASP.NET 2.0 AJAX for your SharePoint Server and how do deploy a UserControl that uses AJAX functionality on you SharePoint Server.

    You can find my previous articles here:

    This blogpost shows a simple implementation of a UserControl that uses the Object Model to query the search service using a keyword and then using an UpdatePanel in AJAX to present the result to the user without any page reloads.

    Let's create an AJAX based UserControl which purpose will be to search using the Search Query Object Model

    Copy the nessecary assemblies to your local bin folder (I'm deploying locally to the WebApplication on port 80)

    To make this work (in this case, since I'm deploying to the UserControls folder with inline code, not calling any own assemblies) you need to copy the two .dll files to your /bin folder of the WebApplication where you want to deploy this UserControl.

    1. Copy C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI\Microsoft.Office.Server.dll
    2. Copy C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI\Microsoft.Office.Server.Search.dll
    3. Paste the two files to C:\Inetpub\wwwroot\wss\VirtualDirectories\80\bin\ (Note: It can be any other port other than 80 if you're deploying to another WebApplication)

    The reason that we copy these files to our deployment target's /bin is simply that I'm deploying locally to that WebApplication and some of the namespaces and classes that we need to use in order to be able to query the Search Object Model are availible in those assemblies. There's better ways to accomplish this, but to keep it simple I'm going with this approach.

    Create the custom AJAX UserControl that will query the SharePoint Search Query Object Model

    For simplicity, I'll reference all the servercode inside the <script> block and not using a code-behind assembly.

    1. Launch Visual Studio 2005 (or whatever version you're running)
    2. Create a new file based on the "Web User Control" template, name it as you please
    3. Add the following tags just below the Control directive:

      <%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %>
      <%@ Import Namespace="Microsoft.Office.Server" %>
      <%@ Import Namespace="Microsoft.Office.Server.Search.Query" %>
      <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>


      It could look something like this:

    4. Just below all the references you just added, add the following code:

      <script runat="server">

      </script>


    5. Add the following code right below the references you just added. This code is simply to give us a simple user interface for the user to perform the search from:
    6. <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
          <ProgressTemplate>
              <img src="http://zimmergren/hostedImages/ajax-loader.gif" alt="Searching..." style="border: 0px none #fff;"/>
          </ProgressTemplate>
      </asp:UpdateProgress>
      <asp:UpdatePanel ID="UpdatePanel1" runat="server">
          <ContentTemplate>
              Enter a keyword to search for<br />
              <asp:TextBox ID="tbSearchString" runat="server" Width="230px"/><br />
              <asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" />
              <asp:Literal ID="literalSearchResults" runat="server" />
          </ContentTemplate>
      </asp:UpdatePanel>


      It could look something like this:

    7. Insert this code inside the <script>-tag you created earlier:

      protected void btnSearch_Click(object sender, EventArgs e)
      {
          // Job insurance, to pause and show that the UpdateProgress works
          System.Threading.Thread.Sleep(2000);
          try
          {
              string startTable = "<table style=\"width: 100%;\">";
              string endTable = "</table>";
              string searchResultItem =
              "<tr>" +
                  "<td><a href=\"{0}\">{1}</a></td>" +
              "</tr>" +
              "<tr>" +
                  "<td>" +
                      "<em>{2}</em>" +
                  "</td>" +
              "</tr>" +
              "<tr>" +
                  "<td>Site: {3}</td>" +
              "</tr>" +
              "<tr>" +
                  "<td style=\"padding-bottom: 10px;\">Author: {4}, Item Size: {5}</td>" +
              "</tr>";
    8.         string outputResults = startTable;

              ServerContext context = ServerContext.GetContext("SharedServices1");
              KeywordQuery keywordQuery = new KeywordQuery(context);

              keywordQuery.ResultTypes = ResultType.RelevantResults;
              keywordQuery.EnableStemming = true;
              keywordQuery.TrimDuplicates = true;
              keywordQuery.QueryText = tbSearchString.Text;

              ResultTableCollection results = keywordQuery.Execute();
              ResultTable resultTable = results[ResultType.RelevantResults];

              if (resultTable.RowCount == 0)
              {
                  literalSearchResults.Text = "Sorry, your search didn't return any results";
              }
              else
              {
                  while (resultTable.Read())
                  {
                      outputResults += string.Format(searchResultItem,
                          resultTable.GetString(5),
                          resultTable.GetString(2),
                          resultTable.GetString(6),
                          resultTable.GetString(8),
                          resultTable.GetString(3),
                          resultTable.GetString(4));
                  }
              }
              outputResults += endTable;
              literalSearchResults.Text = outputResults;
          }
          catch (Exception ex)
          {
              literalSearchResults.Text = ex.Message;
          }
      }

      Instead of going all crazy about how the code actually works with the Search Query Object Model, I'm just pasting the code here for you to try and will explain the Search Query Object Model in another article.

    Deploy the UserControl
    • Copy or Save the UserControl to the following location: C:\Inetpub\wwwroot\wss\VirtualDirectories\80\UserControls\ and you're all set.

    If you've configured AJAX and installed the SmartPart you should be all set and be able to use it. See this short post on using the SmartPart if you don't know already.

    Final Result

    This is what it looks like when you hit the button (the red image spins around for 2 seconds (see the code, Thread.Sleep(2000)) to show how it will look if it's a heavy query and needs some loading time.

    This is what the result will look like, note that everything is done within an UpdatePanel and we do not experience the page to reload, or any visual postbacks.

    Download the UserControl here

  • MOSS 2007: Using AJAX UserControls in SharePoint

    Author: Tobias Zimmergren
    Url:
    http://www.sharepointblogs.com/zimmer

    This post merely shows you how you can use the AJAX functionality in SharePoint by using UserControls.

    What we need to be able to follow the steps in this article

    In the following sections I will describe how you an use the SmartPart by Jan Tielens to host your custom usercontrols in SharePoint. The SmartPart is widely used by a number of people. However, there's also the approach of writing your own wrapper if you want full control of your usercontrol wrapper. Liam Cleary has blogged about doing so here.

    If you've checked the aforementioned requirements, let's get started

    First off, we'll install the AJAX Control Toolkit

    Add the AJAX Control Toolkit to your SharePoint Server

    Download the AJAX Control Toolkit from here and extract all the files into any folder. Search for the AjaxControlToolkit.dll file and make sure you copy it to the same webapplication's /bin directory as you configured for AJAX use. This means that you simply copy the AjaxControlToolkit.dll file to e.g. C:\Inetpub\wwwroot\wss\VirtualDirectories\80\bin if that's the webapplication you've configured AJAX for.

    It might look something like this:

    We're ready for some development, create a new project
    1. Launch Visual Studio
    2. Create a new Web Site with ASP.NET AJAX Support


      Note: The only reason that I create an entire Web Site project is so I can test my UserControls and debug easily on my own development machine before I actually deploy them.
    3. Create a new Web User Control by adding a new .ascx file to your project (I usually delete the .cs file and the reference to the CodeBehind for easy deployment if there's no sensitive code in order to limit the UserControl to one file with embedded code)
    4. It could now look something like this

    Add the AJAX Control Toolkit to your Visual Studio toolbox
    1. Right click in the Toolbox and choose "Add Tab" and choose a name for the new section. (My choice was "AJAX Control Toolkit")
    2. Right click inside the newly created tab, and click "Choose Items..."
    3. Press "Browse" and navigate to your AjaxControlToolkit.dll which you've got somewhere on your machine by now and then click "Open"
    4. You now have a Toolbox filled with the AJAX Control Toolkit controls to use within your project.

    Add a reference to the AJAX Control Toolkit in your UserControl
    1. Switch to designview of your UserControl
    2. Dragging any chosen AJAX Control or Control Extender onto the UserControl will automatically add the reference to the correct Namespace for AJAX in your UserControl. You might want to change the TagName to something more useful than cc1 as it's named automatically.

       
    Create a simple Hello World UserControl
    1. Drop a TextBox in the UserControl
    2. Drop a "CalendarExtender" in the UserControl - It's found in the AJAX Control Toolkit toolbox 
    3. Set the CalendarExtender's TargetControlID property to the ID of the TextBox control.
      The code might look something like this:

      <%@ Control Language="C#" AutoEventWireup="true" %>
      <%@ Register Assembly="AjaxControlToolkit"
                   Namespace="AjaxControlToolkit"
                   TagPrefix="ajaxToolkit" %>
    4. <script runat="server">
          // If there were any server side code, it would go here since I don't use a code behind or pre-compiled assembly to host the code
      </script>

      Pick a date by clicking in the textbox!<br />
      <asp:TextBox ID="TextBox1" runat="server"/>
      <ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server"
      TargetControlID="TextBox1" />

      The UserControl might look something like this when you add it to a page and run:


    5. If you're happy with this very simple Hello World UserControl which uses the AJAX Control Toolkit to extend a Calendar popup, move on to the next section :)
    Deploy the UserControl to SharePoint
    1. Copy your newly created UserControl (in my case, it's called ZimmerAJAX.ascx)
    2. Paste the UserControl to C:\Inetpub\wwwroot\wss\VirtualDirectories\80\UserControls (assuming you're deploying on the standard port 80 site)
      Note: The UserControls directory might not exist at this point, then you'll have to create it manually. The reason that this folder needs to exist is that the SmartPart which will host our UserControl is looking for controls placed inside that folder, unless you're creating your own UserControl Wrapper WebPart, as Liam Cleary explains here

    When you've copied the file to the UserControls directory, the SmartPart will automatically be able to find it.

    Add the SmartPart to your site
    1. Navigate to the site where you want to host your UserControl
    2. Click "Site Actions" - "Edit Page"
    3. Click on one of the Web Part placeholders ("Add a Web Part")
    4. Look for the SmartPart and add it to your page.

    Note: If you havn't added a ScriptManager to either the Masterpage or the default.aspx page, you'll need to use the SmartPart with AJAX instead. In my case I've already configured my masterpage to include a ScriptManager.
    Configure the SmartPart to use your AJAX-based UserControl
    1. Click on "Edit" - "Modify Shared Web Part"
    2. Choose your UserControl from the DropDown at the top of the settings, and click Ok or Apply to apply your changes!


    3. Click "Exit Edit Mode" to exit the edit mode of the page, and view your UserControl
       

    That's a wrap!

    Now your AJAX-enabled UserControl is hosted within a wrapper webpart (SmartPart) and have full AJAX Extensions support.

    Thanks for tuning in. See you soon!

    Cheers!

  • MOSS 2007: Add support for AJAX in your SharePoint installation

    Author: Tobias Zimmergren
    Url:
    http://www.sharepointblogs.com/zimmer

    In this very short and straight-on post I'll just mention how you can configure your SharePoint installation to enable support for ASP.NET AJAX 1.0 since a lot of people have been asking me about it.

    Before we make any changes in the web.config we need the following:

    • A backup of the web.config file (important, because if something goes wrong you might need to revert to the old one)
    • SharePoint (WSS 3.0 or MOSS 2007)
    • ASP.NET 2.0 AJAX 1.0 Extensions
    • Be in the mood for some copy/pasting the following 5 minutes

    Copy/Paste time

    Locate your default web.config file (usually here: "C:\Inetpub\wwwroot\wss\VirtualDirectories\80\web.config").
    Edit the webc.config file according to this scenario:

    1. Locate the <configSection> element and add the following code inside it:

        <sectionGroup name="system.web.extensions"
        type="System.Web.Configuration.SystemWebExtensionsSectionGroup,
        System.Web.Extensions, Version=1.0.61025.0, Culture=neutral
        PublicKeyToken=31bf3856ad364e35">

        <sectionGroup name="scripting"
        type="System.Web.Configuration.ScriptingSectionGroup,
        System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
        PublicKeyToken=31bf3856ad364e35">

        <section name="scriptResourceHandler"
        type="System.Web.Configuration.ScriptingScriptResourceHandlerSection,
        System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
        PublicKeyToken=31bf3856ad364e35" requirePermission="false"
        allowDefinition="MachineToApplication"/>

        <sectionGroup name="webServices"
        type="System.Web.Configuration.ScriptingWebServicesSectionGroup,
        System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
        PublicKeyToken=31bf3856ad364e35">

      <section name="jsonSerialization"
        type="System.Web.Configuration.ScriptingJsonSerializationSection,
        System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
        PublicKeyToken=31bf3856ad364e35" requirePermission="false"
        allowDefinition="Everywhere" />

        <section name="profileService"
        type="System.Web.Configuration.ScriptingProfileServiceSection,
        System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
        PublicKeyToken=31bf3856ad364e35" requirePermission="false"
        allowDefinition="MachineToApplication" />

        <section name="authenticationService"
        type="System.Web.Configuration.ScriptingAuthenticationServiceSection,
        System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
        PublicKeyToken=31bf3856ad364e35" requirePermission="false"
        allowDefinition="MachineToApplication" />

        </sectionGroup>
        </sectionGroup>
        </sectionGroup>

    2. Within the <system.web> element, locate the <pages> element and insert the following snippet:

      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI"
        assembly="System.Web.Extensions, Version=1.0.61025.0,
        Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </controls>

      EDIT: Thanks to Hardik Bhilota for pointing out that I was missing a comma after the version number. Cheers

    3. Within the <assemblies> element, insert the following snippet:

      <add assembly="System.Web.Extensions, Version=1.0.61025.0,
      Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

    4. Within the <httpHandlers> element, insert the following snippet:

      <add verb="*" path="*.asmx" validate="false"
      type="System.Web.Script.Services.ScriptHandlerFactory,
      System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
      PublicKeyToken=31bf3856ad364e35"/>

      <add verb="*" path="*_AppService.axd" validate="false"
      type="System.Web.Script.Services.ScriptHandlerFactory,
      System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
      PublicKeyToken=31bf3856ad364e35"/>

      <add verb="GET,HEAD" path="ScriptResource.axd"
      type="System.Web.Handlers.ScriptResourceHandler,
      System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
      PublicKeyToken=31bf3856ad364e35" validate="false"/>

    5. Within the <httpModules> element, add the following snippet:

      <add name="ScriptModule"
      type="System.Web.Handlers.ScriptModule, System.Web.Extensions,
      Version=1.0.61025.0, Culture=neutral,
      PublicKeyToken=31bf3856ad364e35"/>

    6. And since we need to ensure that the assembly is trusted, locate the <SafeControls> element ad add the following snippet:

      <SafeControl Assembly="System.Web.Extensions,
      Version=1.0.61025.0, Culture=neutral,
      PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI"
      TypeName="*" Safe="True" />

    7. Within the <configuration> element, add the following snippet:

      <system.web.extensions>
        <scripting>
          <webServices>
          <!-- Uncomment this line to enable the authentication
          service. Include requireSSL="true" if appropriate. -->
          <!--
            <authenticationService enabled="true"
            requireSSL = "true|false"/>
          -->
          <!-- Uncomment these lines to enable the profile service.
          To allow profile properties to be retrieved and modified in
          ASP.NET AJAX applications, you need to add each property
          name to the readAccessProperties and writeAccessProperties
          attributes. -->
          <!--
            <profileService enabled="true"
            readAccessProperties="propertyname1,propertyname2"
            writeAccessProperties="propertyname1,propertyname2" />
          -->
          </webServices>
          <!--
          <scriptResourceHandler enableCompression="true"
          enableCaching="true" />
          -->
        </scripting>
      </system.web.extensions>
      <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <modules>
          <add name="ScriptModule" preCondition="integratedMode"
          type="System.Web.Handlers.ScriptModule,
          System.Web.Extensions, Version=1.0.61025.0,
          Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        </modules>
        <handlers>
          <remove name="WebServiceHandlerFactory-Integrated" />
          <add name="ScriptHandlerFactory" verb="*" path="*.asmx"
          preCondition="integratedMode"
          type="System.Web.Script.Services.ScriptHandlerFactory,
          System.Web.Extensions, Version=1.0.61025.0,
          Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

          <add name="ScriptHandlerFactoryAppServices" verb="*"
          path="*_AppService.axd" preCondition="integratedMode"
          type="System.Web.Script.Services.ScriptHandlerFactory,
          System.Web.Extensions, Version=1.0.61025.0,
          Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

          <add name="ScriptResource" preCondition="integratedMode"
          verb="GET,HEAD" path="ScriptResource.axd"
          type="System.Web.Handlers.ScriptResourceHandler,
          System.Web.Extensions, Version=1.0.61025.0,
          Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        </handlers>
      </system.webServer>

    You're all set

    Save your web.config file, restart IIS (iisreset.exe for convenience) and enjoy your ASP.NET 2.0 AJAX 1.0 support in SharePoint.
    This isn't a big deal to accomplish, so that's all you get from this blogpost.

    In the next blogpost I'll talk about how you can easily create a UserControl, hosted with the SmartPart, with support for AJAX.

  • Update to what's going on

    Cheers and thanks for the mails and comments regarding the Silverlight/SharePoint integrations. I've been getting some good feedback and assistance along the way. The next step I need to do is get the VPCs back up running and make some final touches and then start taking screenshots and try to remember what the heck I've done ;)

    Right now there's a lot going on over here, which is the reason to the lack of blogposts lately. I'll try to get some SharePoint-blogging going again and see when I can fit in the Silverlight integration posts in between.

    Part from that, I don't think I'll have time to post anything before christmas so I hereby wish you all a merry christmas!

    See you around, and thanks for the support guys. 

  • Silverlight and SharePoint integration

    I'm writing this post as a question/survey and want to know if there's any interest in actually posting a blog on some different integration-possibilities with SharePoint and Silverligt.

    I've created a couple of smaller projects that uses SharePoint's exposed webservices to create a nice Silverlight application to present the information (in this case some info from the news-list) which then can be displayed nicely on a projector or in a store or why not on the LCD-TV's that a lot of companies have these days to display information to the people that visit the place. Or why not as a billboard - use your imagination.

    With this post I'm just curious as to weather there's any interest in seeing such posts coming up, and if so - please leave me a comment in this post or email me using the contactlink.

    Thanks for tuning in,
    Time to fall asleep on the train here again.

  • Silverlight with Ian Blackburn

    I'm on the train right now with two of my colleagues, heading to Stockholm to attend a Silverlight course held by Mr. Ian Blackburn himself.

    I'll be sure to post some interesting stuff about Silverlight and SharePoint integration soon, as I've made a couple of integrations the past couple of days.

    Cheers

  • MOSS 2007: Customize the Search Result (using XSLT) - Part 3 - Customize using SharePoint Designer 2007

    Author: Tobias Zimmergren
    Url:
    http://www.sharepointblogs.com/zimmer

    After being rather busy the last couple of weeks due to taking the SharePoint Certifications as well as tutoring some MOSS 2007 Development around the country it has finally begun to lighten up again. Being the geeky nerd that I am (Yeah, like you aint?), of course the first thing that comes to my mind is to complete the two articles about customizing the Search Results Page with a third post on the subject which will show you a trick to use SharePoint Designer to generate your custom XSLT. These posts are by no means any in-depth articles on the subject, but rather a pointer to get you started on the journey. If there's interest to create a more in-depth article series about the subject, don't hesitate to contact me using the contactlink from my blog or leave a comment to this post.

    Please refer to the previous articles if you have any questions about editing the xslt for your Search Result. They can be found here:
    MOSS 2007: Customize the Search Result using XSLT
    MOSS 2007: Customizing the Search Results Page (XSLT) - Part 2 - Add highlighting

    Step by step

    First of all, take a look at this picture to understand how it looks before the changes are done (this picture illustrates a standard-layout of the Search Core Results WebPart that is shown when you perform a search in the Search Center)

    Modify the XSLT of the Search Core Results Web Part to get the raw XML

    The search results are actually based on plain XML (which is why we can use XSLT to customize the appearance of the results to a high extent) so what we will do here is to basically use standard XSLT to get ALL the XML elements displayed in the search results as raw XML. This is done because we will use this raw XML in SharePoint Designer to generate some good looking XSLT markup for our Search Core Results Web Part.

    Replace the existing XSLT markup from the Search Core Results Web Part with the following snippet (which basically just give us the raw XML output when searching):

    <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
     <xsl:template match="/">
      <xmp><xsl:copy-of select="*"/></xmp>
     </xsl:template>
    </xsl:stylesheet>

    Now if you publish the page, you will see a result like the result in the following picure, which illustrates how the raw XML could look:

    Make use of the raw XML that SharePoint generated for us in the Search Core Results Web Part

    Copy all the raw XML data (including the <All_Results> tags and save to a new XML-file (I named mine rawsearchresult.xml)

    When you've copied down the raw XML and saved the file, launch SharePoint Designer 2007 - Let the magic begin!

    Use SharePoint Designer 2007 to customize the XSLT for your Search Result Page in SharePoint 2007

    Launch Microsoft SharePoint Designer 2007 and open up your SharePoint site (by going to "File" - "Open Site.." and enter the url to your SharePoint site (in my case, it's "http://zimmergren" and hit open)

    Next, choose File - New - "ASPX" to create a new ASP.NET page. Note that you do not need to save this page because we will only use the page as a base when we customize our XSLT using SharePoint Designer. Later, when we are satisfied with the presentation of our search results, we will simply copy the generated XSLT and close the new .aspx page and ignore the changes.

    Now from the File-meny choose "Data View" - "Insert Data View" to insert a standard DataFormWebPart.

    Note, when inserting the aforementioned Data View, the Data Source Library is opened/displayed in the top right pane (if you havn't customized the appearance of SPD) as seen here:

    In this newly opened Data Source Library we will expand the node that says "XML Files" and choose "Add an XML file...". Browse to your XML file that contains the raw XML and hit okay.

    You will be confronted with a question asking you to import the file into SharePoint, press Ok. When you've hit OK until you're back on the aspx-page, you will see your newly added XML file under the "XML Files" node in the tree in the Data Source Library and in my case it's called "rawsearchresults.xml".

    Click the dropdown of your file, and choose "Show Data". Next, choose the tags/entities that you want to include in the presentation of your Search Result by holding down Ctrl + clicking the ones you'd like to insert.

    Simply drag and drop those items onto the DataFormWebPart on your ASPX-page and it will automatically render the XSLT for you, like so:

    Now, either manually edit the presentation of your search results - or choose the quick edit for your DataFormWebPart and click "Change layout...".

    On dialog, choose your desired layout to base the presentation of your search results on.

    When we've done this, SharePoint Designer automatically renders the XSLT for us (based on the XML File we chose, that contains our raw XML for the Search Results (which is also why we get the nice preview in SharePoint Designer))

    Now, that might not be the best layout to use for displaying the search results on a page.. So we will have to do some manual tweaking in order to get the presentation of this XSLT to fully fit our needs and demands.

    Something that is important to note is how we can e.g. change the title to become a hyperlink that links to the acutal object by choosing the title-element and using the Quick Edit to change some properties. Note that I changed the title to a Hyperlink, which links to {url} that is part of the Search Result and also setting the title to {title} which also is an element in the Search Result.

    Do all your manual tweaking (either by customizing the XSLT from the source view, or as the previous picture illustrated) and continue to the next step.

    Tip: You can of course add Sorting, Filtering and Grouping aswell by simply choosing it in the same dialog that we chose to change the layout..

    Use the XSLT that was rendered by SharePoint Designer 2007 in the Search Core Results Web Part

    Switch to Split View or Source View, and copy the entire <xsl:stylesheet> tag and all content.

    Now simply paste the generated XSLT into your Search Core Results WebPart's XML-section.

    NOTE: If you can't see the entire Web Part and thereby not being able to access the edit-button, you can simply enter the querystring: ?contents=1 which will take you to the Web Part Maintenence Page for your site, where you can delete the webpart, and then add a new one as usual, and edit the XSLT of the new Search Core Results Web Part instead.

    Publish the page, and behold your new presentation of the Search Results. Please note that I didn't make any heavy customizations to my XSLT and therefore it's rather steril, but you can make some major changes in the XSLT and in SharePoint Designer if you really want to customize the display of your Search Results.

    This is how my presentation of the Search Results look like:

    I love feedback and comments :)

    If you liked this article please leave a comment with feedback so I know that people read it, otherwise it's boring to write these step by step illustrated articles.

    Cheers, and good weekend.

  • All certifications passed successfully - Let's get on the blogging-train again!

    As some of you know, I've been rather absent the last couple of weeks and not really replied to mails and comments in the blog. This is because I've concentrated on taking the SharePoint certifications, aswell as being out in the country (Sweden) and consulting. 

    I hereby proudly let you know that I've successfully passed all the four SharePoint 2007 certifications, listed here:

    70-541, 70-542, 70-630, 70-631

    With that said I hope to get some more time for the blog now ;)
    Keep the comments and mails coming, it's highly appreciated.

  • MOSS 2007: Configure Document Conversion for your server

    Author: Tobias Zimmergren
    Url:
    http://www.sharepointblogs.com/zimmer

    I recently bumped into a challenge where I had to make it possible for people to convert their Word, Excel, InfoPath or other documents to a web page for display in your SharePoint 2007 installation. After a few minutes of informationgathering I realized that i could actually make it very simple for myself by using the Document Conversion functionality offered by Microsoft Office SharePoint Server 2007 Enterprise.

    Below is a step by step instruction on how to configure and enable Document Conversion as well as how you will publish and convert a document from e.g. Microsoft Office Word 2007.

     Configuring Document Conversion

    1. Navigate to Central Administration of your SharePoint installation
    2. Click on the tab called Operations
    3. Locate the section Topology And Services and click Services On Server
    4. Start the following two services:
      1. Document Conversions Load Balancer Service
      2. Document Conversions Launcher Service
    5. Choose a load-balancing server and finally set a port-number it should run on.
    6. Click OK - It should state that the services are Started

    7. Navigate to the Application Management tab
    8. Locate the section called External Service Connections and click Document conversions
    9. Choose to enable conversion for this site
    10. Choose a load-balancing server

    11. Click OK

    Convert a document to a Web Page

    1. Launch e.g. Microsoft Office Word 2007
    2. Either choose to create a new document and fill it with some information, or open an existing one
    3. Publish it to a Document Library of your likings by choosing:
      1. The big round Office-button
      2. Publish
      3. Document management server


      4. Enter your portal url: e.g. http://moss-portal/, hit enter, then use the interface to navigate to a Document Library
        1. Save document and Exit Microsoft Office Word 2007
    4. Navigate to your Document Library
    5. Choose Convert Document in the drop down
    6. Choose From Work Document to WebPage


    7. Enter a title of the page
    8. Click Create

    Viola! You should now have a newly generated .aspx page published on your site, created from the Word document you chose.

    Thanks for your time.
    Cheers

  • MOSS 2007: Customizing the Search Results Page (XSLT) - Part 2 - Add highlighting

    Author: Tobias Zimmergren
    Url:
    http://www.sharepointblogs.com/zimmer

    In one of my previous blogposts I wrote about how you easily could alter the XSLT of a the Search Core Results Web Part on your Search Results Page in order to achieve a customization to the presentation of the output.

    In this article I will scratch on the surface of some more XSLT and show you how you can implement the HitHighligting Template in order to achieve colored/customized display of the search words you entered.

    What is the HitHighligting Template?

    Well, basically the HitHighligting template offers you the ability to highlight words that are used in your search. It offers you the possibility to highlight words in the following three result sections: Title, Url and Description (And that's basically all you need, mostly)

    Study the following XSLT, as per MSDN:

    <hithighlightedsummary>
      <c0>SharePoint</c0> <c1>namespace</c1> provides types and members that can be used for working with a <c0>SharePoint</c0> site  <ddd /> a top-level <c2>class</c2> that represents a <c0>SharePoint</c0> site and provides access to its collection of subsites <ddd /> <c0>SharePoint</c0> <c1>namespace</c1> and a brief description of each.
    </hithighlightedsummary>
    <hithighlightedproperties>
      <HHTitle>Microsoft.<c0>SharePoint</c0> <c1>Namespace</c1></HHTitle>
      <HHUrl>
    http://msdn.microsoft.com/library/default.asp?url=/library/en-     us/spptsdk/html/tsnsMicrosoft<c0>SharePoint</c0>_SV01017995.asp</HHUrl>
    </hithighlightedproperties>

    You may notice that the sections hithighlightedsummary, HHtitle and HHUrl elements contain childs (<c0>,<c1> etc). This basically means that for each instance of the words entered in your search, you get a set of highlight-tags that encloses that word. This is the default behaviour of the SharePoint Search. First word gets <c0>, second word gets <c1> and so on...

    How do I add the Highlighting functionality?

    Note: If you do not know how to access the XSLT of the Search Core Results Web Part, .

    In order to customize the presentation of the search result and make your words highlighted, you basically only need to add some tags to the XSL-template for each search word you want to highlight as you can see in the screenshot below.

    Now locate the following section in your Search Core Results Web Part (It already exist):

    <xsl:template name="Hithightlighting">

    And since this template exists from the beginning, all you really have to do is to customize the style attribute and add a color property of the <b> tag (I replaced it with a <strong> tag instead, for sake of standards)
    Then you can simply specify the styles for each highlighted word as picted in the following screenshot:

    It's simple as that. I hope this helped some of you to get started on some basic Search Core Results XSLT customizations.

  • MOSS 2007: Connect a custom Search Page to a custom Search Scope

    Author: Tobias Zimmergren
    Url:
    http://www.sharepointblogs.com/zimmer

    The other day I got a comment on a post from one of my readers who wanted to know how you can connect your custom created Search Page with a specific Search Scope.

    Create a custom Search Page

    1. Navigate to your Search Center (http://yourcompany/SearchCenter)
    2. Choose "Site Actions -> Create Page"
    3. Create a new Search Page by using the "(Welcome Page) Search Page" template and fill in your details

    It should look like this:

    Create a custom Search Results Page

    1. Make sure that you are back at the Search Center site
    2. Choose "Site Actions -> Create Page"
    3. Create a new Search Results Page by using the "(Welcome Page) Search Results Page" template and fill in your details

    It should look something like this:

    Add the newly created Search Page to the tablist in your Search Center

    1. Make sure that you are back at the Search Center site
    2. Choose "Site Actions -> View All Site Contents"

    You will now see one list for the Search Pages and one list for the Search Results Pages, as seen in this picture:

    1. Navigate to "Tabs in Search Pages"
    2. Choose "New -> New Item"
    3. Enter the Title, Page (The page.aspx you created earlier. I used ZimmerSearch.aspx) and optionally enter a Tooltip
    4. Click "OK"
    5. You will see your new Tab show up in the list

    Add the newly created Search Results Page to the Tablist in your Search Center

    1. In the top of your left menu you will see "View All Site Content", Click it.
    2. Repeat the steps from the previous section but use the Search Results Page you created instead.

    If you navigate to your Search Center, you will see that your Tab has been added to the Tablist:

    Connect your Search Page  with your Search Results Page

    1. Click on your newly created Tab
    2. Choose "Site Actions -> Edit Page"
    3. Choose "Edit -> Modify This Shared Web Part" on your Search Box
    4. Under the "Scopes Dropdown" section choose "Show, do not include contextual scopes" in the Dropdown mode
    5. Enter a Dropdown label if you'd like

    It should look something like this:

    1. Expand the "Miscellaneous" section
    2. Enter your Search Results Page filename into the "Target search results page URL" textbox (I used ZimmerSearchResults.aspx)
    3. Click "Ok"

    Now publish the page and it should look something like this:

    Make sure it works

    1. Make a search on your custom Search Page
    2. Make sure that the url contians your custom Search Results Page
      (Mine is: http://zimmer/SearchCenter/Pages/ZimmerSearchResults.aspx)
    3. It works!

    Can I bind the Search Page to a specific Scope?

    Of course you can. Follow these steps:

    1. Navigate to the Site's Scope's section (I usually just navigate to http://zimmer/_layouts/viewscopes.aspx?mode=site)
      (This can be done by just navigating to Site Settings, Go to Top Level site settings, Search Scopes)
    2. Choose "New Display Group"
    3. Enter a Title (Important: Remember this name!)
    4. Choose your Scope in the Scopes list
    5. Make sure it's also the Default Scope
    6. Click OK

    Your displaygroup should be shown with a scope, similar to this:

    1. Go back to your Search Center
    2. Navigate to your custom created Search Page
    3. Again, choose "Site Actions -> Edit Page"
    4. Expand the "Miscellaneous" section
    5. Locate the "Scope Display Group" text box
    6. Enter your newly created Display Group (The name of the display group, mine was Zimmer)
    7. Click "OK"
    8. Publish your page

    The Dropdown with Scopes should now only contain your newly added Display Group, similar to the following screenshot:

    And what do you know... It works :)

    Thanks for taking your time to read this, please leave a comment or two :)

  • MOSS 2007: Customize the Search Result (using XSLT)

    Author: Tobias Zimmergren
    Url:
    http://www.sharepointblogs.com/zimmer

    Since people have been bugging me to get started with the blogging again, I guess I should just take their advice and get to it.

    This blogpost will cover the basics of customizing your search results-page using XSLT.

    I will in a later blogpost also show you how you can use SharePoint Designer as a tool to create the actual XSLT for you in combination with the DataViewer Web Part, and then how you can modify the created XSLT to match whatever specifications you've got in your designs.

    I would recommend creating a new Search Page and Search Results Page to use, but for this little demo I'll just use the default search page and search results page.

    Let's get started then..

    First of, take a look at the search results page (the page you see when you've made a search):
     

    From here, take the following actions: 

    1. Choose Site Actions -> Edit Page
    2. Locate the "Search Core Results" web part, and choose "Edit" -> "Modify Shared WebPart"
    3. Locate "Data View Properties" and choose the huge "XSL Editor..." button :)

    You should now see something like this:

    Now all you need to do (if you wish to use the existing properties) is to add your custom xhtml (I tend to say xhtml instead of html to mark the importance of web standards and cross-browser compatability).

    I just added some style-attributes to the body div and the results template span-tag to mark my point. I did by no means put any energy into making this look nice. Please believe me ;)

    And this is the final "stylish" outcome:

     

    What have we accomplished today then? Well, nothing big at all. Just a little tip on how you can customize the Search Result presentation with minimum knowledge or efforts. I however will in one of my next blogposts let you in on a little tip on how to use SharePoint Designer and the Data View Web Part to create the custom XSLT for you fully automatically instead of customizing the existing XSLT with your own xhtml. That basically means that it's dead-easy to change the looks, layout and appearance of the search results in a much more extensive!

    That's a wrap!
    By the way; I love comments and try to answer them, feel free to add one while you're here :)

  • Back from the Mediterranean

    I was out sailing for the last week, in the mediterranean. One of the best vacations I've had in a long time really. We (two friends of mine and me) sailed from southern Mallorca (Palma) to france (st. Tropez and Antibe) with alot of stops on the way along the Mallorca and Minorca coastlines :)

    I've got some pictures from the "cruise" to post later on, but they're still trapped in my digital camera at home :D

    Before I went to the cruise, I was in the middle-parts of sweden somewhere in my relatives cabin. Basically no water, electricity or any other comfortabilities were at hand. You had a lake and a huuuuge forrest to your disposal :D The mobilephone didn't even have a signal (Yay!) -- Now that's a vacation worth remembering :)

    Hope to be back on the SharePoint blogging-track soon, but got tons of other projects which have priority right now :/

  • Busy busy busy + new laptop :)

    As you may have noticed, I'm rather busy these days and have little time to blog. At the moment I'm working on a mediumsized CommunityServer-based project for a large multinational corporation (not allowed to disclose anymore info ;))

    I'm receiving my new personal laptop today (2.0GHz dualcore 64bit with 2GB RAM running Windows Vista Business), and once I've installed the nessecary things on that machine, the blogging will hopefully take off again!

    Have a good one everybody, and keep codin' !

  • Great News - SharePointBlogs.com post-backups

    Edit: After a search through the database, I found out that there isn't as many SharePointBlogs-posts as I had hoped. However I've managed to get a great bunch of posts recovered to some bloggers through mail and MSN. So after all, it wasn't all in vain =)
    Lastly: Keep up the good work Dustin.

    Original post:
    -------
    I've got some great news.

    As you all know, this site was down during a long time due to a hardware failure and some data was lost/unable to be recovered.. Fear not, for I have backups. 2349 posts to be more specific. (Some are not SharePointBlogs.com, but most are).

    Things to note:
    No images are stored
    No comments are stored (Dang, that's what I love the most about a blog...)

    I'm setting up the database-sync again and hopefully I can get the comments and images stored aswell ;)

    Conclusion for this blogpost is: Leave a comment with your BlogURL and email and I'll get back to you with your specific posts if they're in my database.

    Have a good one everyone!

  • Less time than I thought..

    Having less time over during the evenings this week at the hotel than I thought I'd have.. Conclusion is - as you have noted - that I'm a bit slow on the blogging.

    However, I've got some nice ideas that I will be blogging about soon after I return home.

    Check in soon!

  • Role-Based Templates for SharePoint My Sites

    *sigh* - I just finished a blogpost about the above title, and when I pasted a link in the texteditor, my browser crasched.

    That said, I'm going to make this short, I don't want to re-write it =).