Navigation

Saturday, 17 April 2010

SharePoint 2010 released to manufacturing! Release Schedule announced

Breaking news from the Microsoft SharePoint Team Blog as SharePoint 2010 has been released to the manufacturers.

What does this mean for those waiting to get their hands on it?

SharePoint 2010 Release Schedule

17th April 2010 (today) - RTM

27th April 2010 - Volume License SA (Software Assurance) available for download

1st May 2010 - Volume Licensing available through Microsoft Partners

12th May 2010 - Official global launch to businesses

You can find more details from Jeff Teper, the Corporate Vice President, SharePoint Server here.

Thursday, 15 April 2010

How my Module feature broke the Publishing Feature

So .. there I was in SharePoint 2010, working on a new corporate website in Visual Studio 2010.

We decided we needed some image assets to be provisioned, so I decided to make use of some of the new features of VS2010 and created a "Module" SharePoint Project Item.

I added my images, telling to to deploy to RootWebOnly and setting the path as PublishingImages, everything a good SP dev should do...  or so I thought.

Deployed my solution .. blam .. Site Collection dead. I fired up the (quite excellent) ULS Viewer which told me the following error messages:
'Failed to create the 'Images' library.'. Exception was: 'Microsoft.SharePoint.SPException: A list, survey, discussion board, or document library with the specified title already exists in this Web site.
Publishing Feature activation failed. Exception: Microsoft.SharePoint.SPException: Provisioning did not succeed. Details: Failed to create the 'Images' library.
Now this was instant brown trousers time ... the Publishing Feature was broken!!! (or so I thought).

What had actually happened was brain stunningly simple. You see .. Visual Studio had kindly placed my new Module item into a Site Scoped feature...

The Publishing Feature is Web Scoped...

Now .. hopefully the sharper reader will already have realised the predicament. As I explained in an earlier blog post (onet.xml order of execution) Site Scoped features will activate before web scoped features ... more accurately my Modules feature is trying to place my images into /PublishingImages/ before the document library has been created!!

What it actually did was create a folder in the SPWeb (yes .. you can have SPFolder objects directly within an SPWeb .. you don't need a document library) so when the Publishing feature came along the URL "/PublishingImages" was already in use!

I created a new Web scoped feature for my images module and re-deployed ... everything is now working. (the publishing feature activates first .. creating the image library ... and my images are placed inside it).

*sigh*

Another one to put large and clear on the blackboard of experience!

Controlling the order of Feature Activation in Visual Studio 2010

(Note - this behaviour was observed in VS 2010 RC .. I haven't tested yet in RTM)

One of the most challenging things I've had to deal with in a long time is trying to work out how to get Visual Studio 2010 to activate my Fields feature before it tries to activate my Content Type feature :)

First I was (obviously) getting errors that the field didn't exist (because it couldn't find the Field that the FieldRef was pointing at).

Next I tried adding a Feature Activation Dependency, hoping that Visual Studio would intelligently activate them in the order of the dependencies that I setup ... WRONG ... I am now getting errors saying it cannot activate because the dependency is not active (doh!).

Finally struck upon something .. going to the Package .. the features were being activated in the order they appeared in my VS 2010 Package item.

Unfortunately there is no "move-up", "move-down" or drag and drop re-ordering, so I had to remove all of the features from the package and then put them back in the correct order of activation.

UPDATE
It seems there ARE move-up / move-down buttons, but they don't stick to the scrollbar so if you scroll down (to the bottom of the package) you can't see them anymore. Anyway .. yes you can re-order them .. but you'll maybe find this slightly more difficult if your features are at the bottom of the package list.

Slightly frustrating, but glad it's all working now!

Friday, 9 April 2010

Speaking at the SharePoint Evolution Conference, London

For those who don't know, the SharePoint Evolution Conference 2010 in London is fast approaching. It's 3 days of SharePoint antics with over 70 sessions dedicated to SharePoint professionals and the imminent launch of SharePoint 2010.

I will also be speaking in the Community Track (COM109) on Tuesday 20th April, 2pm-3pm, presenting alongside Kelly Harrison from the RNIB about some of the challenges and lessons learned from building a fully accessible SharePoint system.

It looks to be a really great event, with over 55 expert speakers, from both Microsoft and other well-known companies. Find out more reasons why you should attend and hopefully I'll see you there!

Thursday, 25 March 2010

Un-Publish a list item programmatically

I wrestled with this one for a while. Although you can go to Version History and there is an option to "unpublish" a version doing this programmatically was very much a pain.

I finally realised that you could do this quite simply without going anywhere near the versioning end of the SharePoint API.
// overwrite the "published" version with a "draft" version
item.ModerationInformation.Status = SPModerationStatusType.Draft;
item.UpdateOverwriteVersion();
This did work in my instance where I knew the "current" version of the item was Published, although I'm not sure if this also works when you have draft versions in edit (i.e. version 1.5)

Monday, 8 March 2010

SharePoint 2010 release date (and also my wedding anniversary)

Exciting times and exciting news... the SharePoint 2010 (and Office 2010) release date has finally been confirmed to be 12th May 2010.

The SharePoint team blog posted this up on Friday:
Today, we officially announced that May 12th, 2010, is the launch date for SharePoint 2010 & Office 2010. In addition, we announced our intent to RTM (Release to Manufacturing) this April 2010.
This was further confirmed by the Office 2010 Engineering blog who made this announcement:
For businesses, we will launch the 2010 set of products, including Office 2010, SharePoint 2010, Visio 2010, and Project 2010 worldwide on May 12. To find out more about the Worldwide Business Launch, visit http://sharepoint.microsoft.com/businessproductivity/proof/pages/2010-launch-events.aspx.



For consumers, Office 2010 will be available online and on retail shelves this June. Until then, you can get the Office 2010 beta at www.office.com/beta.


The only problem I have is that May 12th is also my wedding anniversary ...

What do you think? Organise a launch party and cancel the dinner and flowers?? :) (might be more than my wife life is worth)




Monday, 8 February 2010

How to install SharePoint 2010 on Windows 7

For those of you interested in running the SharePoint 2010 Beta 2 on your home computers, or have a Windows 7 workstation and want to get SharePoint up and running, there are a few small pit-falls that you need to be aware of!


Note - all of these tips are covered in the great MSDN article which explains these steps in detail.

64 Bit

the really obvious one is that SharePoint 2010 is 64-bit only, so you need to have Windows 7 x64 edition installed!

Pre-requisites

The second kicker is that you will have to install the pre-requisites manually! the auto-installer for Server 2008 simply doesn't work on Windows 7.

One of the easiest ways to achieve most of these is to install the Visual Studio 2010 Beta 2. This sets up many of the pre-requisites, including .Net Framework 4 and Silverlight :)

Some of the other steps (such as making sure you have IIS and SQL installed) you will have to do manually though.

Note - The MSDN article contains detailed information on which pre-requisites you need to install, and how to do it!

Installing SharePoint 2010

Ok .. the first thing you will notice is that the installer won't actually let you install it. You will get an error message warning you that you actually need to be running Windows Server 2008. (Fear not .. you haven't got the wrong download!)

There are 2 easy steps to get it all working:

1) Open a command prompt, and run the installer with the /Extract argument. This will extract the files from the installer to a specified directory. For example:
OfficeServer.exe /extract:c:\OfficeServer
2) Once the files have extracted, go to the "..\Files\Setup\config.xml" and open this file for editing (e.g. C:\OfficeServer\Files\Setup\config.xml)

You need to add in a line in the tag, just before the Configuration tag:
<Setting Id="AllowWindowsClientInstall" Value="True" />

Now you can run the Setup.exe from the extracted folder (e.g. C:\OfficeServer\setup.exe), and installation of SharePoint 2010 begins!

cheers!

Martin

Wednesday, 3 February 2010

Epic Fail - Saving to a document library overwrites AllItems.aspx

This was a major "doh" moment .. learnt the hard way.

I don't know if this is because I'm using Word 2010 beta, but I was working on a document that I wanted to save into a SharePoint library.

So I copy pasted the URL into the "Save As" dialog (including the ".../Forms/AllItems.aspx" bit on the end).

I expected it to show me a view of my library.

I got a Word Document saved as "AllItems.aspx".

Epic Fail! :)



Tuesday, 2 February 2010

IIS7 broke my Content Deployment! (404 - Not Found error)

Important one to bear in mind this, especially as SharePoint 2010 is likely to have the same limitation (IIS7!)


Content Deployment works by creating exports of the Site Collection data, and splitting it up into CAB files with a default size of 10MB. These are then shipped off to the target Central Admin Application (using a Layouts page called DeploymentUpload.aspx). Once all the CAB files have been received they are imported into the database of the target site collection.

All very simple, but what do you do when your Content Deployment job starts throwing errors like "404 - Not Found"?? (note - Content Deployment errors end up in the Windows Application Logs).

Well, the first place to look would be your IIS logs for your Central Administration application (which for IIS7 are located in the C:\inetpub folder). Look for a reference to "DeploymentUpload.aspx" with a 404 error reference.. which I have an example of below:
2010-02-02 10:16:29 ::1 POST /_admin/Content+Deployment/DeploymentUpload.aspx filename=%22ExportedFiles18.cab%22&remoteJobId=%22b8a556bc-8eef-4f6f-97b6-6bac54ae8d99%22 40197 - ::1 - 404 13 0 78
Now, I have highlighted the error fragment which states that this is a 404.13 error (or Content Length Too Large)! The reason for this is that one of the CAB files is too big, and IIS7 has a file upload limit of about 27MB!

Now, the quick witted among you will remember I said that the CAB files automatically split up into 10MB chunks .. but if MOSS comes across a file that is too big it will simply expand the file size until it can fit that file in!! In the case of a project I'm working on this lead to a 68mb CAB file!

The only workaround is to configure the IIS7 Virtual Directory for Central Administration to allow file uploads big enough for my CAB file to get through (in my case, I set it to 80,000,000 bytes, approx 75MB).

To do this, open up a command prompt, navigate to C:\Windows\System32\Inetsrv\ and execute the following command:

appcmd set config "SharePoint Central Administration v3" -section:system.webserver/security/requestFiltering -requestLimits.MaxAllowedContentLength:80000000

Restarted the Content Deployment job and all good .. working again :) So something to bear in mind ... why IIS7 can break your Content Deployment Jobs!!

Wednesday, 27 January 2010

Fixed: SPWeb.Navigation.QuickLaunch == null

This one plagued me for quite some time.. you create a new site, and some pages. The navigation menus are all there but when you look in code the SPNavigationNodeCollections are null.

This is the same for both the standard WSS navigation collection (SPWeb.Navigation.QuickLaunch) and the publishing site collection (PublishingWeb.CurrentNavigationNodes).

However ... you navigate the the "Modify Navigation" screen and make any change, click Ok and magically all the nodes appear in code!

Why does this happen?
the main thing is the role of the "SiteMap" providers in SharePoint. These are what really drive your navigation rendering, presenting an XML map of the "nodes" structure of your pages and using controls like the ASP.Net menu to render them.

The problem is, these don't always match up with the data in the content database around navigation settings. I think this follows the similar grounds of "ghosting" in that (for performance reasons) the SPNavigationNodeCollection doesn't get filled up with data until you "customise" something.

This is normally achieved by going to the "Modify Navigation Settings" page and clicking the "ok" button, at which point SharePoint conveniently goes and populates the nodes collection, and it becomes available to you in code.

What can I do about it?
Well, thankfully there is a fix for this.

You can manually create the nodes yourself, but you DO have to add some special node properties so that SharePoint recognises them as being "linked" to the existing pages and sites, otherwise you end up with duplicates all over the place!

The trick is that any node you add for pages you add a custom Property of NodeType set to the value of Page. For sub-sites you set this property to Area.

This way, SharePoint sees your custom nodes as being "Page" and "Site" nodes instead of new custom links!

Simple eh???

The code is listed below:
// use a Publishing Web object so we can access pages


PublishingWeb pWeb = PublishingWeb.GetPublishingWeb(web);

// use this to store the urls that exist in the current nav

List currentUrls = new List();

foreach (SPNavigationNode node in web.Navigation.QuickLaunch)

{

// collect all of the existing navigation nodes

// so that we don't add them twice!

currentUrls.Add(node.Url.ToLower());

}

foreach(PublishingPage page in pWeb.GetPublishingPages())

{

// check to make sure we don't add the page twice

if (!currentUrls.Contains(page.Uri.AbsolutePath.ToLower())

&& page.IncludeInCurrentNavigation)

{

// create the new node

SPNavigationNode newNode = new SPNavigationNode(page.Title, page.Url);

newNode = web.Navigation.QuickLaunch.AddAsFirst(newNode);

// IMPORTANT

// SET THE NodeType to "Page"

newNode.Properties["NodeType"] = "Page";

// save changes

newNode.Update();

}

}

foreach(SPWeb tempWeb in web.Webs)

{

// make sure we don't add the sub-site twice

if (!currentUrls.Contains(tempWeb.ServerRelativeUrl.ToLower()))

{

// create the new node

SPNavigationNode newNode = new SPNavigationNode(tempWeb.Title, tempWeb.ServerRelativeUrl);

newNode = web.Navigation.QuickLaunch.AddAsLast(newNode);

// IMPORTANT

// SET THE NodeType to "Area"

// (this is a throwback to SPS 2003 where it used

// "Portal Area" instead of sub sites)

newNode.Properties["NodeType"] = "Area";

newNode.Update();

}

}

// save changes to the Publishing Web

pWeb.Update();