SharePoint Development Blog

Nick Boumans
View my LinkedIn Profile Follow me on Twitter View my Profile on FaceBook View my projects on CodePlex View my presentations on SlideShare



Recent posts

Tags

Categories

Navigation

Pages

Archive

Blogroll

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

Loading a custom menu build in Office into SharePoint WebPart

In Powerpoint and Word 2007 (and Word 2010) we can choose to save as: Single File Web Page (*.mht; *.mhtml). In this way we can make a nice graphical menu structure (using e.g. shapes and hyperlinks).

So I made a simple organogram and added hyperlinks to to shapes. This hyperlinks point to sharepoint pages. It looks like:

 

- Save your menu (or clickable presentation) as Single File Web Page (Not in PowerPoint 2010, here you have to choose Word).
- Upload the .mht file to a document library
- Add a Page Viewer WebPart to a Page
- Point the Page Viewer WebPart URL to the .mht file of that doc lib

Works in SharePoint 2007 (Office 2007) and SharePoint 2010 (Office 2010, however the optiion to save as single file web page has been removed in PowerPoint 2010 Beta).

Posted: Dec 20 2009, 16:50 by Nick Boumans | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Complete Single Server SharePoint 2010 installation using local accounts

In SharePoint 2007 we could choose a single server installation (which installed SQL Server express) or a Farm installation (which uses SQL non express). It was possible to use local accounts for the Farm Installation too.

In SharePoint 2010 we can’t use local accounts for the Farm Installation. However if you choose for single server installation you get SQL Server Express 2008. To Fix this on a development environment I came to the blogpost of Neil 'The Doc' Hodgkinson: http://sharepoint.microsoft.com/blogs/fromthefield/Lists/Posts/Post.aspx?List=0ce77946%2D1e45%2D4b43%2D8c74%2D21963e64d4e1&ID=112&Source=http%3A%2F%2Fsharepoint%2Emicrosoft%2Ecom%2Fblogs%2Ffromthefield%2FLists%2FPosts%2FAllPosts%2Easpx

This method worked for me on the public beta. The steps I followed:

  1. Choosed the farm installation method
  2. Didn’t run the configuration wizard directly after installation
  3. Installed SQL Server 2008 SP1 Fix: KB970315 x64
  4. Restarted IIS (If not I got problems in the following steps)
  5. Start Menu >> Microsoft SharePoint 2010 Products >> SharePoint 2010 Management Shell
  6. You get a SharePoint 2010 Management Shell (PS C:\Users\Username)
  7. Type: New-SPConfigurationDatabase
  8. DatabaseName: SharePoint_2010_ConfigDB
  9. DatabaseServer: e.g. DEV (It’s your computername)
  10. Now your prompted for the Farm Credentials. Please insert them
  11. The last step in insert a Passphrase: you can choose some of your own
  12. After this completes you will find in SQL a new configuration database and an admin content database
  13. Run the SharePoint Products Configuration Wizard
  14. Choose: Do not disconnect form this server farm (it takes your config database and database server automatically)
  15. Follow the other steps in the wizard

Note: For development environments only. Don't use this at a production environement. Set your password expiration to 0 days (never).

Posted: Dec 17 2009, 20:38 by Nick Boumans | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Adding a Ribbon to SharePoint 2010

If you take a look to HOL10 - Developing SharePoint 2010 User Interface Ribbon and Dialog Customizations: http://www.microsoft.com/downloads/details.aspx?FamilyID=c010fc68-b47f-4db6-b8a8-ad4ba33a35c5&displaylang=en you will notice that this Hands on Lab will not work for the public beta. If you want to follow this lab and make it work, please update your elements.xml to the next code:

<?xml version="1.0" encoding="utf-8"?>
<!-- also take a look at: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\GLOBAL\XML\CMDUI.XML -->
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
    Id="Hello_world"
    RegistrationType="List"
    RegistrationId="101"
    Location="CommandUI.Ribbon"
    Sequence="5">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.Documents.Manage.Controls._children">         
              <Button
            Id="Ribbon.Documents.New.DemoHelloWorldButton"
            Alt="Hello World Ribbon Button"
            Sequence="5"
            Command="Demo_HelloWorld"          
            Image32by32="_layouts/images/YourProject/YourImage.jpg"
            LabelText="Hello World Demo"
            TemplateAlias="o1"/>           
        </CommandUIDefinition>
        </CommandUIDefinitions>
      <CommandUIHandlers>       
        <CommandUIHandler
        Command="Demo_HelloWorld"
        CommandAction="javascript:alert('Hello World!');" />       
      </CommandUIHandlers>      
      </CommandUIExtension>
  </CustomAction>
</Elements>


[/code]
 

You can view this Ribbon if you navigate to the Documents Folder. If you want to make a Ribbon visible on other places (e.g. page which actually is a WikiPageTab) take a look to this file:  C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\GLOBAL\XML\CMDUI.XML in your SharePoint root. In the CMDUI.XML you can find the definitons of the default Ribbons which could be helpfull to extend it with your own. E.g. you can find group ID's and sequences of the Ribbons.

If you want to extend the SiteActions menu you can take a look at the next elements.xml code

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction Id="UserInterfaceCustomActions.SiteActionsToolbar"
    GroupId="SiteActions"
    Location="Microsoft.SharePoint.StandardMenu"
    Sequence="1000"
    Title="MY SITE ACTIONS BUTTON">
    <UrlAction Url="javascript:alert('Hello World!');"/>
  </CustomAction>


</Elements>

 

Posted: Nov 28 2009, 10:43 by Nick Boumans | Comments (0) RSS comment feed |
  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Add an assembly to your Visual Studio 2010 SharePoint Package

If you are familiar with WSP-builder for development with SharePoint 2007, the way of adding assemblies to your SharePoint 2010 project is a little different. You always start with an empty SharePoint project. From here you can add other items. In WSP-builder you had the bin and GAC folder in Visual Studio.

To add an assembly to your Visual Studio 2010 SharePoint Package (SharePoint 2010) 

  1. Open you Package.package file.
  2. On the bottom of the window you can choose: Design | Advanced | Manifest
  3. Choose Advanced

 

SP2010 Add Assembly

You can choose for an excisting assembly or the output assembly of your project.

You can deploy the assembly to the GAC (C:\Windows\Assembly - The Global Assembly Cache, full trusted) or the WebApplication (actually the Bin Folder of your WebApplication in your InetPub folder of your WebServer).

 

Posted: Nov 28 2009, 10:30 by Nick Boumans | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Turn Developer Dashboard on or off in SharePoint 2010

You can turn the Developer Dashboard on or off by using the next .bat file. Make sure you run this file as administrator. Otherwise a message "access denied" will be shown.

ECHO ON


SET STSADM="C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\bin\stsadm"


REM ----- Choose one of this three commands -----
REM ----- Turn Developer Dashboard ondemand -----
%STSADM% -o setproperty -pn developer-dashboard -pv ondemand


REM ----- Turn Developer Dashboard on -----
%STSADM% -o setproperty -pn developer-dashboard -pv on


REM ----- Turn Developer Dashboard off -----
%STSADM% -o setproperty -pn developer-dashboard -pv off


pause 

SP2010 Developer Dashboard

Posted: Nov 28 2009, 10:14 by Nick Boumans | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Installing SharePoint 2010 on Windows 7

Installation Guide

A nice feature of SharePoint 2010 (Foundation and Server) is that you can install a single server environment on Windows 7. Waning, only use this type of installation for development purposes. After downloading a copy of SharePoint 2010 (beta at the moment) from e.g. MSDN you can’t directly install it on Windows 7. If you try to run the installer as administrator you get a message like: “Setup is unable to proceed due to the following error(s): This product requires Windows Server 2008 (x64). Correct the issue(s) listed above and re-run setup.”
To install it on Windows 7 you have to follow the next steps:

  1. Copy the installer to your harddrive of installation (e.g. C:\sharepoint)
  2. Rename the installer to spinstaller.exe
  3. Extract the installation files by opening a Command Prompt (Run > CMD)
  4. Type: C:\sharepoint\spinstaller /extract:c:\sharepoint
  5. This will extract the installer
  6. Navigate in your Windows Explorer to: c:\sharepoint\files\setup\config.xml
  7. Edit this file in notepad and add the next line <Setting Id="AllowWindowsClientInstall" Value="True"/> just before the </Cofiguration> tag (Case sensitive)
  8. Save the configuration file
  9. Make sure the next Windows Features are turned on (Control Panel > Turn Windows Features on or off):

//You can do this quickly by copying and running the following command in a Command Prompt window.
//The following text contains line breaks. You must remove the line breaks to run this script from a command prompt.
start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;
IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;
IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;
IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-HealthAndDiagnostics;
IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;
IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;
IIS-RequestFiltering;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;
IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-IIS6ManagementCompatibility;
IIS-Metabase;IIS-WMICompatibility;WAS-WindowsActivationService;WAS-ProcessModel;
WAS-NetFxEnvironment;WAS-ConfigurationAPI;WCF-HTTP-Activation;WCF-NonHTTP-Activation
  1. Install SharePoint 2010 by running c:\sharepoint\setup.exe as administrator
  2. Choose the installation you want: Standalone (Installs SQL Server Express)
  3. After the installation is complete you, will be prompted to start the SharePoint Products and Technologies Configuration Wizard. Before starting the wizard, first install the Microsoft SQL Server 2008 KB 970315 x64.
    1. After the Microsoft SQL Server 2008 KB 970315 x64 installation is finished, complete the wizard. If it is closed you can find it in your start menu.
    2. Note: Some people also had to install HotFix KB976462 available here https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=23806&wa=wsignin1.0 before running the configuration wizard.

Note: you can even install SharePoint 2010 on Windows Vista. Please visit http://msdn.microsoft.com/en-us/library/ee554869(office.14).aspx for more information.

Trouble Shooting

  • If the configuration wizard breaks at step 2, showing the next error message: "System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified." a dll of the Geneva Framework is missing. Please install this framework containing the DLL and run the wizard againg. The next link contains the right dll: Download Geneva Framework. 
  • If the configuration wizard breaks at step 8, showing the next error message:

The WCF-NonHttp-Activation Windows Feature isn't checked. If you followed the tutorial on MSDN: http://msdn.microsoft.com/en-us/library/ee554869(office.14).aspx and didn't use the script but cross checked the features with the screenshots in the article, you missed this feature. Activate it (command prompt: start /w pkgmgr /iu:WCF-HTTP-Activation;WCF-NonHTTP-Activation;) or by Control Panel > Programs > Turn Windows Features on or off.

Posted: Nov 25 2009, 07:43 by Nick Boumans | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

An unexpected error has occurred - SharePoint Error Page

Lot of course participants of my development courses ask me how to fix the error: An unexpected error has occurred.

If you find nothing in the SharePoint Log you can modify the web.config

<SafeMode MaxControls="200" CallStack="true">
<customErrors mode="Off"/>

You will no longer see the "An unexpected error has occurred" error page and instead you get a lovely ’standard ASP.Net error page’ with the stack trace and everything! It is a best practice to do this on you're development environment. Don't forget to switch it on production!

 

Posted: Nov 17 2009, 23:04 by Nick Boumans | Comments (0) RSS comment feed |
  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Enable Google Wave in SharePoint Content Editor WebPart

"Google Wave is an online tool for real-time communication and collaboration. A wave can be both a conversation and a document where people can discuss and work together using richly formatted text, photos, videos, maps, and more."
At the moment of writing Google Wave is currently in a limited preview. In this post I will describe how you can load a "Wave" into the SharePoint content editor WebPart. No development knowledge or server deployment is needed to follow this steps.

  • Get an Google Wave account.
  • Create a new wave.
  • Get the Wave ID. In the developer preview you can do this by while the Google Wave is active, select Debug>Get current Wave ID. In the public release this is not as easy. However you can add the next buddy to your wave: embeddy@appspot.com This buddy generates JavaScript code including the Wave ID. You can see this in the next screenshot.

  • Copy the Generated Javascript.
  • Go to your SharePoint site.
  • Add a Content Editor WebPart and go to the source editor.
  • Paste your JavaScript code.
  • Congratulations, now you have your Wave into SharePoint.
  • Additionally you can "pimp" your JavaScript. You can use http://code.google.com/intl/nl/apis/wave/guide.html as a reference.

My Content Editor WebPart Source Code is: 

<div id="wave" style="width: 100%; height: 500px"></div>


<script
  type="text/javascript"
  src="http://wave-api.appspot.com/public/embed.js">
</script>
<script type="text/javascript">
  var wave =
    new WavePanel('https://wave.google.com/wave/');
  wave.setUIConfig('white', 'black', 'Arial', '13px');
  wave.loadWave('googlewave.com!w+YOURWAVEID);
  wave.init(document.getElementById('
wave'));
</script>

 

Posted: Nov 03 2009, 07:41 by Nick Boumans | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: SharePoint General

Centering a Page using divs for IE and FireFox

Lot of people spend lot of time on the "Look and Feel" of a site. For SharePointers this often means customizing the CSS and masterpage. The Default SharePoint Masterpage is centered on the left. However in lot of situations you want a div or table centred at the screen. The next screendump is an example of centering a page in the browser window.

If you want to center a page also you can use the next snippet.

<!-- Center a page using DIVs IE and FireFox -->
<!-- E.g. SharePoint centered MasterPage -->

<html>
  <head>
  <title>My Centered Page</title>
  <style type="text/css">
  BODY {
    height:100%;
    background-color: #FF00DD;   
  }

  .PageContainer{
    width: 100%;
    height: 100%;
    background-color: #FF00DD;   
    /* For IE6 */
    text-align: center;    
    /* For other browsers */
    margin-left: auto;
    margin-right: auto;
  }

  .MainContainer{
    width: 950px;
    padding-top: 0px;
    /* For IE6 */
    text-align: center;
    /* For other browsers */
    margin-left: auto;
    margin-right: auto;

  }
  </style>
  </head>
  <body>
    <form>
    <!-- Custom -->
    <div class="PageContainer">
    <!-- For SP development you maybe want to put this outside your page -->
    <!-- This is a SiteAction button for publishing page -->
        <div class="SettingsMenu">
      <PublishingSiteAction:SiteActionMenu runat="server"/>
    </div>
    <div class="MainContainer">
        <!-- All other content place holders here... -->
      </div>
    </div>
    </form>
  </body>
<html>

Note: Since extranet SharePoint pages use several browsers I preffer using Div's. In the CSS you can see several tags for e.g. Internet Explorer and FireFox.

 
Posted: Nov 02 2009, 08:15 by Nick Boumans | Comments (1) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: SharePoint General

SDC 2009 Session material

At the beginning of this week I gave two sessions at the SDN Conference at Papendal (Netherlands). The content of this sessions was about

  1. Social Networking in SharePoint 2007 - Building innovative WebParts using SharePoint, AJAX and jQuery
  2. E-Commerce using SharePoint 2007 and Commerce Server 2009

Abstract Session 1: We al know: LinkedIn, Twitter, and Hyves. Since we're using SharePoint for public internetsites more and more I developed a messaging webpart for SharePoint for quick sharing messages. This uses innovative techniques as AJAX.NET, jQuery and mySites. I will use this example to explain some SharePoint development concepts for developing innovative webparts in combination with Social Messaging. Level: 200 - Intermediate.

Abstract Session 2: Did you know the Netherlands has over 20,000 WebShops? Since a lot of customers use SharePoint it's possible that some people have to build a webshop in SharePoint. Are you writing all that kind of webparts using custom code? Or do you feel more about an out of the box e-commerce site using SharePoint? On the Dutch DevDays 09 I spoke about Commerce Services 2009 for SharePoint. Since I was a last-minute speaker (I replaced a session) there is a chance you skipped my presentation. Now you've got a second chance. Level: 100 - Beginners

All attendees received a nice green bag containing a CD with all the session and demo material. For the people who lost their CD or didn't attend the SDC, you can get the presentations here (Dutch):

SDC09 IW01 Nick Boumans - Social Networking.ppt (1.72 mb)

SDC 2009 IW02 Nick Boumans - eCommerce.ppt (2.30 mb)

For Source Codes please visit: http://spmessaging.codeplex.com or http://csextensions.codeplex.com

 

Posted: Oct 22 2009, 09:02 by Nick Boumans | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5