Today I’m going to show you how to upload documents to a document library in SharePoint 2010 and also to create folders via web services in the document library.

I configured a document library where I want to create folders and store documents. I named it “My Documents Library” located at “http://server/sites/personal/My Documents Library”

Let’s Create Folders

In your .Net project you have to add a service reference to http://server/sites/personal/_vti_bin/Dws.asmx. This is the Document Workspace service.

Here is the code to create a folder in the document library:

  1: // Title of Document Library
  2: string library = "My Documents Library";
  4: DwsSoapClient client = new DwsSoapClient();
  5: if (client.ClientCredentials != null)
  6: {
  7:     client.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;
  8: }
 10: try
 11: {
 12:     // Create First Folder
 13:     string createResult = client.CreateFolder(library + "/Folder One");
 14:     Trace.WriteLine("Create Folder Result: " + createResult);
 16:     // Create subfolder
 17:     createResult = client.CreateFolder(library + "/Folder One/Folder Two");
 18:     Trace.WriteLine("Create Folder Result: " + createResult);
 19: }
 20: finally
 21: {
 22:     if (client.State == CommunicationState.Faulted)
 23:     {
 24:         client.Abort();
 25:     }
 27:     if (client.State != CommunicationState.Closed)
 28:     {
 29:         client.Close();
 30:     }
 31: }

The first thing to watch out for is setting the client credentials on the client proxy. This tells the client to impersonate you to create the folders. You the client need to have the rights to create folders in the document library.

To create folders is very straight forward where you use the CreateFolder method. As you can see you specify the library title and forward slash with the new folder to create. I also show in the code to create subfolders.

Let’s Upload a Document

To upload a document we need to add another service reference to http://server/sites/personal/_vti_bin/copy.asmx. This is the Copy service.

Here is the code to upload a document to the document library:

  1: CopySoapClient client = new CopySoapClient();
  3: if (client.ClientCredentials != null)
  4: {
  5:     client.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;
  6: }
  8: try
  9: {
 10:     client.Open();
 11:     string url = "http://server/sites/personal/My Documents Library/Folder One/Folder Two/";
 12:     string fileName = "test.txt";
 13:     string[] destinationUrl = { url + fileName };
 14:     byte[] content = new byte[] { 1, 2, 3, 4 };
 16:     // Description Information Field
 17:     FieldInformation descInfo = new FieldInformation
 18:                                     {
 19:                                         DisplayName = "Description",
 20:                                         Type = FieldType.Text,
 21:                                         Value = "Test file for upload"
 22:                                     };
 24:     FieldInformation[] fileInfoArray = { descInfo };
 26:     CopyResult[] arrayOfResults;
 28:     uint result = client.CopyIntoItems(fileName, destinationUrl, fileInfoArray, content, out arrayOfResults);
 29:     Trace.WriteLine("Upload Result: " + result);
 31:     // Check for Errors
 32:     foreach (CopyResult copyResult in arrayOfResults)
 33:     {
 34:         string msg = "====================================" +
 35:                      "SharePoint Error:" +
 36:                      "\nUrl: " + copyResult.DestinationUrl +
 37:                      "\nError Code: " + copyResult.ErrorCode +
 38:                      "\nMessage: " + copyResult.ErrorMessage +
 39:                      "====================================";
 41:         Trace.WriteLine(msg);
 42:         _logFactory.ErrorMsg(msg);
 43:     }
 44: }
 45: finally
 46: {
 47:     if (client.State == CommunicationState.Faulted)
 48:     {
 49:         client.Abort();
 50:     }
 52:     if (client.State != CommunicationState.Closed)
 53:     {
 54:         client.Close();
 55:     }
 56: }

Again I set the client credentials to be able to upload documents to the document library. I have to specify the full URL and folder structure on where I want to upload the document too. I also have to append the filename onto the URL to upload the document.

I create a byte[] to simulate document content that will be saved in the document library. The web method that we use to upload a document only accepts an byte[] for content. If you use streams for reading a local file to upload, then you have to convert it to a byte[].

We use the CopyIntoItem method to upload the file. Firstly have to define the filename, the destination URL, file information array and a array for results that is returned.

In the example code I use the fileInfoArray to add document meta data. In the example I just add Description meta data.

When you upload the file the method returns an array of results that you can check if any errors occurred on the server for the document upload.

Hope this helps you and any feedback is welcome!


This blog entry will show you how to setup SharePoint 2010 on Windows 7. Unfortunately it is not just as simple as to download SharePoint 2010 and say install. You can use SharePoint 2010 Foundation, Full SharePoint 2010 editions and Search Server 2010 Express for the rest of this blog entry.

Step 1:

Download your desired SharePoint 2010 edition. For the rest of this blog I will use SharePoint 2010 Foundation.

Step 2:

If you try to run the SharePointFoundation.exe and select Install SharePoint Foundation you will get the following error:


You need to enable Windows 7 support. Before doing that we have to extract the SharePoint 2010 setup file to a directory. Go to command prompt and type the following:


Step 3:

To enable Win 7 support you have to go to C:\SharePointFiles\Files\Setup folder and open config.xml in a text editor. In the file you have to add this line <Setting Id="AllowWindowsClientInstall" Value="True" />. Your file should look like this:

Enable _Win7_Config

Step 4:

Before we run the setup you need to enable IIS on Windows 7. Go to Control Panel->Program and Features->Turn Windows features on or off.


The most important features that should be enabled is the Internet Information Services and Microsoft .NET Framework 3.5.1.

A quick solution is to run the following in command prompt: ( Take out the line-breaks for command prompt )

start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;

Step 5:

After IIS is installed we need to install some additional prerequisite packages that is required by SharePoint 2010. Under c:\SharePointFiles run PrerequisiteInstaller.exe.

Required Prerequisite Packages:

Step 6:

After the prerequisite packages are installed, it is recommended to run Windows Update to install the latest patches from Microsoft.

Step 7:

Ok, now you are ready to install SharePoint 2010. Under c:\SharePointFiles run setup.exe and select the option that suite you the best. Most of the time it should be the Standalone option that will install a stand-alone SharePoint 2010 installation with SQL Server Express.


Note: After installing SharePoint 2010 check for the latest patched from Windows Updates.

Step 8:

After successful installation, you are ready to use SharePoint 2010 on Windows 7. Here is the default site that is created with sample data:


The default is accessible via the URL http://machine-name/.  SharePoint takes over the default port 80 on IIS.

Another page that is available is the  SharePoint 2010 Central Administration. Accessible via URL http://machine-name:34078/ Just check in IIS on which port it runs. Otherwise you can all so go to the Start menu->All Programs –> Microsoft SharePoint 2010 Products –> SharePoint 2010 Central Administration.


For Development you have to follow these additional steps.

Step 9:

Install the SharePoint 2010 SDK. I’m going on the assumption that Visual Studio 2010 is already installed on Windows 7 machine. The SDK provide conceptual overviews, programming tasks, code samples for SharePoint 2010.

Step 10:

Install SharePoint 2010 Guidance. This guidance provides a deep technical insight into the key concepts and issues for SharePoint 2010 solution developers.

Helpful Additional Tools for Development:

With these steps completed you are ready to start developing with SharePoint 2010.

Enjoy SharePoint 2010.


If you are looking for some introduction material to Microsoft Workflow Foundation 4.0 then here are a couple of links and tips.


Windows Workflow Foundation (WF) Overview Wiki


Windows Workflow Foundation (WF) Screencasts:

Endpoint TV screen cast:


Blogs that I follow for updates and development tips on WF 4.0

Andrew Zhu Blog -

Ron Jacobs -

Unit Testing:

WF 4.0 is much more Unit Testing friendly. Ron Jacobs created WF 4.0 Unit Testing Helper library that is available at


Microsoft WF 4.0 Forum -

Using WF 4.0 with WCF 4.0 is one of the greatest experiences I have so far and one powerful toolset to know. These details should get you started with WF 4.0.

After you understand WF 4.0, I suggest you start looking at Microsoft AppFabric technology stack.


In Part 2 we start with the some coding. To start the Football Boss project I use the Html 5 Boilerplate project with is available at Please go and have a look at the site and especially the code. There are a few very interesting bits that developers forget to put into their web projects.

Anyway, back to Football Boss. Just for interest, I’m using Notepad++ on Windows 7 to code Football Boss. So, you can use your favourite text editor to follow.

In the default boilerplate code of the index.html page you will see the div with an id of container. This is where we will put our code for the page design.

<div id="container">
    <div id="main">
</div> <!-- end of #container –>

Immediately you will see that we use some new Html 5 tags namely <header> and <footer>.

  • <header> = header for a section or page.
  • <footer> = footer for a section or page.

I quickly want to take you to the top of the page. Do you spot something different? In the Html 5 specification they have made the DOCTYPE short. <!doctype html> This short DOCTYPE indicate that the html should be parsed as Html 5. No version is specified so that the DOCTYPE will remain usable for future revisions of Html. Usually if you use XHMTL Transitional or Strict you would have to put this long DOCTYPE at the top of your page: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

Here are some additional changes that Html 5 brings:

  • Attribute for language – <html lang=”en”> is all what is required for Html 5. xmlns or xml:lang is not required anymore.
  • Attribute for Character Set – Define character encoding using the new charset attribute in meta tag: <meta charset=”utf-8” />
  • Trailing slashes are not required – Void elements (e.g. br, img and input) don’t require a trailing slash.
  • Deprecated elements: <acronym>, <applet>, <basefont>, <big>, <center>, <dir>, <font>, <frame>, <frameset>, <noframes>, <s>, <strike>, <tt>, <u> and <xmp>

In part 1 I drawn a wireframe of what content I want and how the layout of the content should be on the page. For the initial design I hard code certain content that might be dynamic at a later stage and use dummy data that will be replaced with real data later on.

Firstly in the <header> tag I create a hgroup and h1 tag for specifying my page title. After that I add a paragraph with some text to check if JavaScript is enabled in the browser. If JavaScript is enabled then the JavaScript code will hide the paragraph.

<hgroup> = Group a set of h1-h6 elements.

  1: <header>
  2:   <hgroup>
  3:     <h1>Football Boss - Choose a Team and let's play!</h1>
  4:   </hgroup>
  5:   <p id="jsnotice">
  6:     Javascript is currently disabled. 
  7:     This site requires Javascript to function correctly.
  9:     Please <a href="" target="_blank"> enable Javascript in your browser</a>!
 11:   </p>
 13: </header>

After header I define the page menu inside a <nav> tag that is new to Html 5.

<nav> = Specify navigation links.

  1: <nav>
  2:     <ul>
  3:       <li>Home</li>
  4:       <li>Contact</li>
  5:     </ul>
  6:   </nav>

After the navigation menu is the main div. Inside the main div I define two main sections namely football and instructions. If you look at the wireframe you see that we need two team tables and a field canvas. In the football section I define two sections and inside each section I define two tables to list the starting team players and reserves. In between the two team sections I define a canvas tag. On the canvas tag we will create the football match simulation.

In the instruction section I define a article tag with a header and paragraph that will explain to the user how to play Football Boss. As a extra bonus I added the new video tag to also show a video to the user on how to play the game.

  1: <div id="main">
  2:     <section id="foolball">
  3:       <section id="team1">
  4:         <table id="team1Table">
  5:           <caption>Red Team</caption>
  6:           <thead>
  7:             <tr>
  8:               <td>#</td>
  9:               <td>Player Name</td>
 10:               <td>Position</td>
 11:               <td>Fitness</td>
 12:             </tr>
 13:           </thead>
 14:           <tbody>
 15:             <tr>
 16:               <td>1</td>
 17:               <td>Red Player 1</td>
 18:               <td>GK</td>
 19:               <td>100</td>
 20:             </tr>
 21:           </tbody>
 22:         </table>
 23:                 <table id="reserve1Table">
 24:                     <caption>Red Team Reserve</caption>
 25:           <thead>
 26:             <tr>
 27:               <td>#</td>
 28:               <td>Player Name</td>
 29:               <td>Position</td>
 30:               <td>Fitness</td>
 31:             </tr>
 32:           </thead>
 33:           <tbody>
 34:             <tr>
 35:               <td>14</td>
 36:               <td>Red Player 2</td>
 37:               <td>GK</td>
 38:               <td>100</td>
 39:             </tr>
 40:           </tbody>
 41:                 </table>
 42:       </section>
 43:       <canvas id="fieldCanvas"></canvas>
 44:       <section id="team2">
 45:         <table id="team2Table">
 46:           <caption>Blue Team</caption>
 47:           <thead>
 48:             <tr>
 49:               <td>#</td>
 50:               <td>Player Name</td>
 51:               <td>Position</td>
 52:               <td>Fitness</td>
 53:             </tr>
 54:           </thead>
 55:           <tbody>
 56:             <tr>
 57:               <td>1</td>
 58:               <td>Blue Player 1</td>
 59:               <td>GK</td>
 60:               <td>100</td>
 61:             </tr>
 62:           </tbody>
 63:         </table>
 64:                 <table id="reserve2Table">
 65:                     <caption>Blue Team Reserve</caption>
 66:           <thead>
 67:             <tr>
 68:               <td>#</td>
 69:               <td>Player Name</td>
 70:               <td>Position</td>
 71:               <td>Fitness</td>
 72:             </tr>
 73:           </thead>
 74:           <tbody>
 75:             <tr>
 76:               <td>14</td>
 77:               <td>Blue Player 2</td>
 78:               <td>GK</td>
 79:               <td>100</td>
 80:             </tr>
 81:           </tbody>
 82:                 </table>
 83:       </section>
 84:     </section>
 86:     <section id="instructions">
 87:       <article>
 88:         <header>
 89:           <h2>How to play:</h2>
 90:         </header>
 91:         <p>
 92:           Select a team and click Play!
 93:         </p>
 94:                 <video>
 95:                     <source src="video/demo.mp4" />
 96:                 </video>
 97:       </article>
 98:     </section>
 99:     </div>

As you can see it is allot of code. The following tags are all new Html 5 tags:

  • <section> = define a section in the document.
  • <canvas> = draw graphics with JavaScript on canvas.
  • <article> = define unique article content.
  • <video> = natively play video content.
  • <source> = define media resources. Used between video and audio tags.

There are more new semantic tag from Html 5 spec:

After the main div we define the page footer. In the footer tag we add copyright content and later social icons or mailto link.

  1: <footer>
  2:     Copyright @ 2010 by Cecildt
  3: </footer>

That is the basic layout of Football Boss main page. Note that this is the initial design and some small changes to the semantics might change. If you open the index.html page in your favourite browser you would see the dummy content on the page, but the content has no styling yet.


In the follow up posts we will start to style each section with CSS 3.0. With the styling post I will go deeper into the new Html 5 tags and their attributes that is available. I will try to keep the styling post nice and short for each section.

I hope you see how Html 5 improves the semantics of the content on the page and that you enjoyed this post. Any suggestions and feedback are welcome!

Side note: Mozilla has started their GameOn competition. I will enter this Football Boss application, when I finish it, as my entry into the competition. For this reason I will provide the full source for the application to the public, but I keep the sole right to provide this application into any competition.

Source Code


Follow me on twitter: @cecildt

This is my first entry into a deep dive with Html 5. I’ve played allot with Html 5, but I think I need to implement a page that use as much of the Html 5 features. This will be a n-part series. I have no idea how many entries there will be. I will try make the entries as simple and short as possible to follow.

Firstly I needed an idea for a page to create. I came up with a football management page idea. A very simple idea where two football teams play against each other. The user choose one team and select team  players to play against the other team. During the game the user will be able to change players from the field with players on the bench. I hope you like the idea.

Here is a wireframe of the page layout:

Football Boss

The actual football game simulation will be done on the new canvas element from Html 5. I will take each section and feature in detail in follow up entries. I think this is a great starting point and at each entry I will provide the source for you.

Any suggestions and feedback would be great!