SharePoint

SharePoint Holiday Loader

Submitted by Robert MacLean on Mon, 02/21/2011 - 12:33
March 19, 2012: This tool has had a major make over since the original release!

logo

I’m sure, as a SharePoint power user, you’ve had the fun of your boss walking up to you and asking why the public holidays aren’t in your SharePoint calendar? (guess what happened to me last week)

You would think this would be easy, in fact Outlook supports adding holidays to calendars easily. So why isn’t SharePoint easy like that too?

I’ve had this asked a few times and never had a good answer to do it, so I decided that a simple tool needed to be built to solve this once and for all – Let me introduce SharePoint Holiday Loader (SHL).

SHL takes a standard holiday file (.hol) and allows you to publish that to a SharePoint list!

Clipboard01

This tool is very easy to use (just need the file, the server and the calendar name) and it is free and open source. You can get the download the tool, source code, leave comments (or complaints) at: https://bitbucket.org/rmaclean/sharepoint-holiday-loader/

Source Code Management for the Individual SharePoint Developer

Submitted by Robert MacLean on Mon, 01/24/2011 - 09:39

imageWith SharePoint 2010 and Visual Studio 2010 the ability to be a productive developer was key and there is tight out-of-the-box integration and this means that it is easy for SharePoint developers to put code into source control easily. Hilton Giesnow covers this brilliantly in a video he has: http://bit.ly/g71Gnb

Imagine a number of dedicated SharePoint developers, they may have an enterprise ALM solution like TFS and on their own machines have SharePoint 2010 Developer and VS2010 installed and life is good – but what about the individual, or ad-hoc, developer?

The problem for him is that installing SharePoint 2010 is a resource hog and you may not want it running all the time (what Hilton nicely calls the 9 to 12 development) and what about if you switching between projects, how do you switch SharePoint? The solution I found, is to have a virtual machine (VM) for SharePoint with the dev tools installed and do all work on the VM. This is great because the overhead is only there when you need it and you can easily switch between different virtual environments. The downside: source code management.

Sure you can hook up the VM to the network and manage code using the source control as you are used too, but this isn’t always easy or possible, so what else you can do? I had this problem recently where the source control is on one domain and my development was another domain. I choose to use the Mercurial Distributed Version Control System (DVCS) and I thought I would share this experience with you.image

DVCS differs from “traditional” source control like TFS or SubVersion which has a client/server model where each developer is a client talking to a central server, however in DVCS every developer is their own server and does pushes/pulls (think like a sync) between other developers.

What this enables is a very lightweight set of tools installed along side SharePoint and the developer tools on the VM. At the end of each day I could run Mercurial on my machine and pull the source control down to my own machine. This meant the VM had the code and my “real” machine had the code. Then this code could easily be checked into the corporate source control system creating another backup and ensuring compliance with source management policies!

This has been a very exciting project and this configuration really made the management of the source code very smooth.

Bring your hard drive to Community Night

Submitted by Robert MacLean on Mon, 12/13/2010 - 12:48

Blue Male Student in a Graduation Cap, Reading a Book and Leaning Against a Stack of Books Clipart IllustrationIf you are coming to tomorrow’s community night, you want to bring your hard drive along because I will have some stuff to fill it up with:

Plus I hear that some prizes may be given away at the events too Winking smile

Visual Studio Service Pack 1 - Beta: Field Guide

Submitted by Robert MacLean on Fri, 12/10/2010 - 09:24

Brian Harry announced the availability of the service pack 1 beta which is fantastic news for all developers. This post is a field guide of me doing the installs.

Before that I wanted to point out a few key things included in this SP:

  • This can installed in production – this beta includes a “go live” license so it is supported and upgrades to the RTM of the SP will be supported.
  • This includes over 80 hotfixes for between 800 and 1000 bugs and many new features. For a full list see the link above, but here is a brief list:
    • Silverlight 4 tool support!
    • Unit testing can target the 3.5 framework now.
    • IntelliTrace support for 64bit and SharePoint!
    • Performance Wizard for Silverlight!
    • HTML 5 support
    • IIS Express support
    • SQL Compact Edition 4 Tooling

Details on the last three can be found on Hanselman’s blog.

  • Some third party systems may break with this, at this time known ones are:
    • ASP.NET MVC 3 RC 1 – this will be fixed in the next update.
    • Visual Studio Async CTP – this will break completely! No news, yet, on when it will be fixed.

The Process

For me there are three files you need to get:

  • Update for .NET 4
  • Update for Visual Studio
  • Update for Team Foundation Server (not covered in this post)

Step 1

.NET 4 installInstall the .NET 4 update first – this took on my machine 24 minutes to do. It is important to note that I did shutdown Visual Studio first but I had some other applications open, including Pull which is .NET 4.

At the end of the process I needed to restart!

image

This step is no specifically needed as the VS SP will include this automatically, however I personally like the idea of doing it manually and making sure .NET 4 apps continue to work before I continue to the VS install.

Step 2

imageOn to the Visual Studio install which after a few minutes tells you what will be updated and then, tells you that it wants to download 490Mb!

image

What I had done was to download the smaller installer version (less than 1Mb) which means it first figures out what is needed and then downloads the rest. This is great for some people as the download size is less, however since I live in South Africa (read: bandwidth is a luxury) and I work with 300+ other developers it is better for me to get the “DVD” labelled one which is bigger (in my case 103Mb bigger) but contains everything in one go so it can be shared easily and the bandwidth hit just once!

image

Step 3

We re-join the action a while later (when the “DVD” edition downloaded, approx. 1 hour 21 min later) we start process again and this time the download size is 0Mb Open-mouthed smile 

image

This took 29 min to process (remember this is without the download) this install and success!

image

Notes

I haven’t found anything in the many extensions I use daily that has broken! In particular my favourites all work

Upgrade to SharePoint 2010 on Small Business Server: Field Guide

Submitted by Robert MacLean on Thu, 12/09/2010 - 10:58

SharePoint2010_LogoRecently I needed to do an upgrade from SharePoint 2007, to be exact WSS 3.0, to SharePoint 2010 – “No big deal” I thought, “I’ve done it before”. Assumptions, they do make for interesting life experiences, because this was something different – this was an upgrade on a Small Business Server (SBS) deployment.

logo-ms-sbsFor those who do not know, SBS is a lightweight all in one server product. So when you install it you get Windows Server 2008, plus Exchange Server, plus ISA, plus SharePoint, plus plus plus – ALL PRE-CONFIGURED! It is fantastic to use in small companies.

Microsoft has produced a fantastic upgrade guide for this very scenario: http://technet.microsoft.com/en-us/library/ff959273(WS.10).aspx but I think is missing a few footnotes of things I found during my upgrades, which this blog post aims to share.

Check Lists

Blue Man Holding a Clipboard While Reviewing Employess Clipart IllustrationI’ve made two check lists of things you should do ahead of time:

Software

This is the software that you will need during the upgrade.

Environment

This is some prep for the environment you can do a head of time.

  • Get a service account created on the domain for SharePoint to use.
  • Get a service account created on the domain for SQL 2008 R2 to use as it can’t use network service on a domain controller.
  • Check if there is a public internet FQDN setup and get the details of that, will need this when setting up the AAM.
  • Get domain name used for email.
  • Check for a local domain name for the site, normally companyweb. Verify this can be access on the server and also from a workstation on the network.
  • Make sure it is a domain controller – there is some scenarios where you are not installing on a domain controller but it is SBS in which case a lot of the guide and process will be broken.

Notes

Here are my additional notes for the guide. For some steps I have no notes because there was nothing extra special about those processes that needed noting.

Step 1

  • It is easier to check the version number in add/remove programs by showing the version number column. Service Pack 2 has a version number of 12.0.0.6421 so we want that or higher.
  • Alternatively turn on show updates in add/remove programs and see if SP 2 is installed.

Step 4

  • It is not important to disable the service during the copy, provided your server will not be rebooted during step 4 and no one is accessing the SharePoint site.
  • It is VITAL to place these files in a backup location and then copy the content database files MDF/LDF to a secondary location. This location is where the database files will be used from in future.
  • Make sure the database files are NOT read only.

Step 6

  • It is a complete farm install, not a stand alone farm install

Step 7

  • It is ok for the site not to exist

Step 8

  • If the Central Admin “Getting Started Wizard” pop’s up, it is ok to cancel it wizard
  • Make sure the app pool is set to Network Service

Step 13

  • If you get a Default Web Error it is because the default and intranet names are the same – make sure they are not.
Additional steps post upgrade

CommNight December - Some interesting events

Submitted by Robert MacLean on Tue, 12/07/2010 - 10:07

Happy Blue Man Partying With a Party Hat, Confetti and a Bottle of Liquor Clipart IllustrationIn the middle of the company parties, you should take one night off to do some fantastic learning and networking at CommNight (Community Night) on the 14th December! You can read about all the details on the Microsoft DPE Blog.

There are two groups which I want to highlight which will be at CommNight:

S.A. Developer

S.A. Developer is a user group for developers and in December will be hosting the following topics:

  • Tool of the month: This short (10min to 15min) session is where someone can present their favourite developer focus tool or add-on.
  • Unit Testing WPF & Silverlight – Tools & Techniques: Silverlight and WPF can be used to create truly immersive UI experiences for users.  Testing these UI components and the logic around it can become complex – especially when using frameworks like PRISM.  Join us in this session as we take a look at a few tools and techniques that can be used when unit testing WPF and Silverlight applications. 

Really looking forward to this session!

Information Worker

Information Worker is a user group for those in the IW space, not just developers but everyone even people who job just involves Excel and Outlook! This month we are looking at:

  • Lync – Microsoft’s Unified Communication System
  • Windows Phone 7 – What does this give the IW user? Things like Office and SharePoint integration will be discussed

SharePint @ Tech·Ed 2010!

Submitted by Robert MacLean on Fri, 10/08/2010 - 09:43

After a full day of learning new and interesting SharePoint tips, tricks and ideas, come and hang out with fellow SharePoint enthusiasts to help digest your new knowledge and a pint or two of anything else you like.
Hosted by The MOSS Show, with with some prizes to give away, it should be a fun evening for all.
RSVP essential as we need to finalise venue bookings!
Date: Monday, 18 Oct.
Venue: Cubana Durban, 128 Florida Road
Time: 7:00 p.m.
Dress: Collared shirts & smart shoes for gents
Map & Directions from the CCI: View Map
Click to Register Here
A special thanks to our Sponsors:
Sponsors

Upload files to SharePoint using OData!

Submitted by Robert MacLean on Tue, 09/28/2010 - 09:07

I posted yesterday about some pain I felt when working with SharePoint and the OData API, to balance the story this post cover some pleasure of working with it – that being uploading a file to document library using OData!

This is really easy to do, once you know how – but it’s the learning curve of Everest here which makes this really hard to get right, as you have both OData specialisations and SharePoint quirks to contend with. The requirements before we start is we need a file (as a stream), we need to know it’s filename, we need it’s content type and we need to know where it will go.

For this post I am posting to a document library called Demo (which is why OData generated the name of DemoItem) and the item is a text file called Lorem ipsum.txt. I know it is a text file, which means I also know it’s Content Type is plain/text.

The code, below, is really simple and here are what is going on:

  • Line 1: I am opening the file using the System.IO.File class, this gives me the stream I need.
  • Line 3: To communicate with the OData service I use the DataContext class which was generated when I added the service reference to the OData service and passed in the URI to the OData service.
  • Line 8: Here I create a DemoItem - remember in SharePoint everything is a list or a list item, even a document which means I need to create the item first. I set the properties of the item over the next few lines. It is vital you set these and set them correctly or it will fail.
  • Line 16: I add the item to the context, this means that it is being tracked now locally – it is not in SharePoint yet. It is vital that this be done prior to you associating the stream.
  • Line 18: I associate the stream of the file to the item. Once again, this is still only happening locally – SharePoint has not been touched yet.
  • Line 20: SaveChanges handles the actual writing to SharePoint.
using (FileStream file = File.Open(@"C:\Users\Robert MacLean\Documents\Lorem ipsum.txt", FileMode.Open))
{
    DataContext sharePoint = new DataContext(new Uri("http://<sharepoint>/sites/ATC/_vti_bin/listdata.svc"));                

    string path = "/sites/ATC/Demo/Lorem ipsum.txt";
    string contentType = "plain/text";
    DemoItem documentItem = new DemoItem()
    {
        ContentType = contentType,
        Name = "Lorem ipsum",
        Path = path,
        Title = "Lorem ipsum"
    };

    sharePoint.AddToDemo(documentItem);

    sharePoint.SetSaveStream(documentItem, file, false, contentType, path);

    sharePoint.SaveChanges();
}

Path Property

The path property which is set on the item (line 12) and when I associate the stream (line 18, final parameter) is vital. This must be the path to where the file will exist on the server. This is the relative path to the file regardless of what SharePoint site you are in for example:

  • Path: /Documents/demo.txt
    • Server: http://sharepoint1
    • Site: /
    • Document Library: Documents
    • Filename: demo.txt
  • Path: /hrDept/CVs/abc.docx
    • Server: http://sharepoint1
    • Site: /hrDept
    • Document Library: CVs
    • Filename: abc.docx

Wrap-up

I still think you need to still look at WebDav as a viable way to handle documents that do not have metadata requirements, but if you have metadata requirements this is a great alternative to the standard web services.

Cannot add a Service Reference to SharePoint 2010 OData!

Submitted by Robert MacLean on Mon, 09/27/2010 - 11:22

SharePoint 2010 has a number of API’s (an API is a way we communicate with SharePoint), some we have had for a while like the web services but one is new – OData. What is OData?

The Open Data Protocol (OData) is a Webprotocol for querying and updating data that provides a way tounlock your data and free it from silos that exist in applicationstoday. OData does this by applying and building upon Webtechnologies such as HTTP, Atom PublishingProtocol (AtomPub) and JSON toprovide access to information from a variety of applications,services, and stores.

The main reason I like OData over the web services is that it is lightweight, works well in Visual Studio and works easily across platform, thanks to all the SDK’s.

Clipboard01SharePoint 2010 exposes these on the following URL http(s)://<site>/_vti_bin/listdata.svc and you can add this to Visual Studio to consume using the exact same as a web service to SharePoint, right click on the project and select Add Service Reference.

Once loaded, each list is a contract and listed on the left and to add it to code, you just hit OK and start using it.

Add Service Reference Failed

Clipboard03The procedure above works well, until it doesn’t and oddly enough my current work found a situation which one which caused the add reference to fail! The experience isn’t great when it does fail – the Add dialog closes and pops back up blank! Try it again and it disappears again but stays away.

Clipboard04If you check the status bar in VS, you will see the error message indicating it has failed – but by this point you may see the service reference is listed there but no code works, because the adding failed.

If you right click and say delete, it will also refuse to delete because the adding failed. The only way to get rid of it is to close Visual Studio, go to the service reference folder (<Solution Folder>\<Project Folder>\Service References) and delete the folder in there which matches the name of your service. You will now be able to launch Visual Studio again, and will be able to delete the service reference.

What went wrong?

Clipboard06Since we have no way to know what went wrong, we need to get a lot more low level. We start off by launching a web browser and going to the meta data URL for the service: http(s)://<site>/_vti_bin/listdata.svc/$metadata

In Internet Explorer 9 this just gives a useless blank page Sad smile but if you use the right click menu option in IE 9, View Source, it will show you the XML in notepad. This XML is what Visual Studio is taking, trying to parse and failing on. For us to diagnose the cause we need to work with this XML, so save it to your machine and save it with a .csdl file extension. We need this special extension for the next tool we will use which refuses to work with files without it.

Clipboard07The next step is to open the Visual Studio Command Prompt and navigate to where you saved the CSDL file. We will use a command line tool called DataSvcUtil.exe. This may be familiar to WCF people who know SvcUtil.exe which is very similar, but this one is specifically for OData services. All it does is take the CSDL file and produce a code contract from it, the syntax is very easy: datasvcutil.exe /out:<file.cs> /in:<file.csdl>

Immediately you will see a mass of red, and you know that red means error. In my case I have a list called 1 History which in the OData service is known by it’s gangster name _1History. This problem child is breaking my ability to generate code, which you can figure out by reading the errors. 

Solving the problem!

Clipboard09Thankfully I do not need 1 History, so to fix this issue I need to clean up the CSDL file of _1History references. I switched to Visual Studio and loaded the CSDL file in it and begin to start removing all references to the troublemaker. I also needed to remove the item contract for the list which is __1HistoryItem. I start off by removing the item contract EntityType which is highlighted in the image along side.

The next cleanup step is to remove all the associations to __1HistoryItem.

Clipboard10Finally the last item I need to remove is the EntitySet for the list:

BREATH! RELAX!

Ok, now the hard work is done and so I jump back to the command prompt and re-run the DataSvcUtil tool, and it now works: Clipboard12

Clipboard14This produces a file, in my case sharepoint.cs, which I am able to add that to my project just as any other class file and I am able to make use of OData in my solution just like it is supposed to work!

Next time on Information Worker

Submitted by Robert MacLean on Thu, 08/26/2010 - 10:27

IWLogoText

If you follow the IW website you may have seen that the September community meeting in Jo’burg would be about SharePoint 2010 Deployments. That has changed to something far more exciting: Double Demo Day!

Double Demo Day means we get to see two members of the community do a demo of something very interesting.The demos are:

Creating Workflows with SharePoint Designer 2010, InfoPath and Visio

Creating workflows with Visio 2010 and SharePoint Designer 2010 has never been easier. In this session I’ll go through the process of rapidly creating and deploying workflows in a SharePoint 2010 environment.

This will be presented by Ridwan Sassman, who helped us out last month with video taping the session.

Branding SharePoint 2010 with MasterPages, Layouts and CSS

One of the largest limitations of WSS3.0 and MOSS2007 is the ability to brand SharePoint without intricate knowledge of the platform and in some cases breaking a few rules and modifying out of the box system files to get the desired look and feel. Come and see how the theming engine in SharePoint 2010 together with CSS, Master Pages and Layouts can be used to brand your SharePoint site using the amazing new SharePoint Designer 2010.

This will be presented by Brent Samodien. If you have been to a SLAB’s you will know Brent as he helps us with the venue!

October

Looking ahead to October – there is no Jo’burg community meeting. Why? ‘cause we will all be at Tech·Ed Africa 2010! If you haven’t registered then you must do so NOW! Or you could try and win a free entry!