Friday, 4 December 2009

Creating Office Web Apps Service Applications with PowerShell

I was following the “Deploy Office Web Apps (SharePoint Server 2010)” beta guide published by Microsoft and got to the part on page 8 where it describes how to create the service applications and their proxies using PowerShell.

I ran the following script documented in the article:

$appPool = Get-SPIisWebServiceApplicationPool
–Name “SharePoint Web Services Default”
New-SPWordViewingServiceApplication –Name “WdView” –AppPool $appPool |
New-SPWordViewingServiceApplicationProxy –Name “WdProxy”
New-SPPowerPointServiceApplication –Name “PPT” –AppPool $appPool |
New-SPPowerPointServiceApplicationProxy –Name “PPTProxy”
New-SPExcelServiceApplication –Name “Excel”
-SPIisWebApplicationPool $appPool |

Well, I didn’t even get past the first line without PowerShell reporting an error. I could have switched to the UI and configured it there, but as I decided to crack the problem instead. After a good old trial and error session, the script now reads:

$appPool = Get-SPIisWebServiceApplicationPool –Identity “SharePoint Web Services System” |
New-SPWordViewingServiceApplication –Name “WdView” –ApplicationPool $appPool |
$WdViewSA = Get-SpServiceApplication -Name "WdView" |
New-SPWordViewingServiceApplicationProxy –Name “WdProxy” -URI $WdViewSA.Uri.AbsoluteUri |
New-SPPowerPointServiceApplication –Name “PPT” –ApplicationPool $appPool |
New-SPPowerPointServiceApplicationProxy –Name “PPTProxy” -ServiceApplication "PPT" |
New-SPExcelServiceApplication -Name "Excel" -ApplicationPool $appPool |

Hope this helps someone…. at least until RTM launches and they have rewritten the documentation :-)

Thursday, 12 November 2009

Corrupt Global Navigation in SharePoint

I came across a problem with the global navigation in a MOSS site collection where the top navigation bar only showed a link to its own site and another one showing the word “Error”.

ErrorWhen you hovered over the link, it displayed the message “An error occured while rendering navigation for requested URL” with a “The system cannot find the file specified (Exception from HRESULT: 0x80070003)” exception message. When I tried to change the navigation using the normal site settings option, it gave me a “File Not Found” message with a pretty large and undecipherable stack trace.

I tried deactivating the publishing features at both the site and site collection level, which returned the normal WSS navigation bar back successfully, but when I reactivated the features, the problem came back again.

I thought I might have more success via the Object Model, so I developed a small Windows application that goes through all the navigation nodes and deletes them one by one. I ran this application pointing at the relevant site collection and although it reported a “Cannot complete this action. Please try again” message, it did enough to get rid of the Error message in the navigation bar and allow me to go back into the navigation settings using the browser and delete the remaining nodes.


I have uploaded the application to my SkyDrive, in case it helps anyone else out there: Download

Tuesday, 20 October 2009

SharePoint 2010 White Papers

There are lots of SharePoint Server 2010 white papers appearing on the Microsoft Website to coincide with the SharePoint Conference happening in Las Vegas this week -

Thursday, 1 October 2009

“This item cannot be deleted because it is still referenced by other pages” and “There is no file with url” errors when trying to delete a master page in MOSS 2007

I tried to delete a custom master page in MOSS 2007 and it gave me the following message:

This item cannot be deleted because it is still referenced by other pages

Microsoft published a workaround for this here, which suggests hiding the master page, but I needed to replace it with a new one and hiding it didn’t seem like a good idea to me. So, I thought I’d try and delete it in SharePoint Designer, which showed exactly the same message as the browser UI. I then tried to delete the file in Windows Explorer, and it disappeared, but then reappeared in the UI again. Grrrrrr!

I also noticed that if I tried to change the properties of the file, it gave me a “There is no file with url” error, which pointed to some sort of corruption or orphaned file. I uploaded a new file over the top to resolve this error, but I still couldn’t delete the file.

Not a perfect solution, but the only way I could overcome the problem was to open the Master Page Gallery in Windows Explorer, create a new folder (I called it “Unused”), and move the master page into the folder. I could then upload the new master page and use it as normal. You will still probably want to perform the actions suggested in the Microsoft article referenced above to hide the faulty one, or it will appear in the Site Master Page Settings page in Site Settings, otherwise you will have two master pages to choose from – the replacement one recently uploaded and the old one preceded with the name of the folder you created to hide it.

Wednesday, 9 September 2009

Problem adding Keywords and Best Bets programmatically in MOSS 2007

I was writing a small Windows application for a customer to create keywords and best bets using a CSV file and experienced a weird problem. I used the code published here by Stefan Go├čner as a starting point, which successfully added the keywords to the Manage Keywords UI in Site Collection Administration, but when I tried to search on one of the keywords, no best bets were shown in the search results.

The format of the CSV file was, as follows:

Keyword name, Synonyms (semi-colon delimited), Best bet URL

For example: Acme Primary School, Acme;Acme School;Acme Primary,

The code I used to create the keywords was:

keywords.AllKeywords.Create(keywordTerm, DateTime.Today.AddHours(-1));
keywords.AllKeywords[keywordTerm].BestBets.Create(objBestBet.ToString() + " Profile", "Full school profile for " + objBestBet.ToString(), new Uri(objUrl.ToString()));

I then found that if I clicked on one of these keywords in the Manage Keywords UI and clicked OK without changing anything, the search for that keyword worked. I eventually discovered that SharePoint didn’t like adding the semi-colon delimited synonyms as a single string and that they needed to be created separately. Therefore, I changed the code to below, using the semi-colons to split the string up into an array of separate synonyms, which worked:

keywords.AllKeywords.Create(keywordTerm, DateTime.Today.AddHours(-1));
//Create synonyms from semi-colon separated array
string[] synonymArray = objSynonyms.ToString().Split(new char[] { ';' });
foreach (string synonym in synonymArray)
keywords.AllKeywords[keywordTerm].BestBets.Create(objBestBet.ToString() + " Profile", "Full school profile for " + objBestBet.ToString(), new Uri(objUrl.ToString()));

Wednesday, 20 May 2009

Multiple Site Manager for SharePoint

I have finally managed to more or less polish my Multiple Site Manager for SharePoint application and publish it on Codeplex. You can get it from here:

Multiple Site Manager for SharePoint

Multiple Site Manager for SharePoint is a server tool which allows administrators to create, delete, and manage SharePoint 2007 sites, site collections, and My Sites either using a CSV file. Site columns with specific settings can also be created using XML.


Full details can be found on the Codeplex site. If you have any questions or requests for future releases, please let me know.

Wednesday, 22 April 2009

Creating a simple feedback or request form Web Part using SharePoint Designer

Here are some steps you can use to create a Web Part using SharePoint Designer that displays a new item form for a list with a submit button. It provides an interface for users to be able to post feedback or requests for information (brochures, documents, etc.) without having to go to the standard new item form for the list. The advantage here is that you can add this Web Part to a dashboard or home page to provide a better user experience.

  • First, we need to create the list. In this example, I would like to give users the option of requesting a number of different brochures. I have created a custom list called “Brochure Requests” with the following columns (I have renamed the default “Title” column to “Your Name”) – The “Brochure Type” column allows the user to choose which documents they wish to be sent:


  • Go to the page on the site where the Web Part will be created (To prevent the live page from being customised by SharePoint Designer, you may want to create the Web Part on a dummy page in the same site, export it to a file, import it on the live page, and delete the dummy page).
  • Edit the page in SharePoint Designer, click on the Web Part zone, and select Insert Data View from the Data View menu.
  • From the Data Source Library, click on your custom list and select Show Data.


  • Select the columns that you would like to show in the Web Part (for my example, I have chosen Your Name, Your Address, and Brochure Type), click the Show Selected Fields as… button, and select New Item Form.


  • The Web Part will now appear in the page. From here you can change all sorts of options to style it how you want. I need to change the text on the Save button to Submit, so I have double-clicked the button and changed the Value/label setting.
  • Once finished, save the page.
  • Go to the page in the browser and give it a try.


When users click the Submit button, the item will be created in the list. Because the columns are referenced directly from the Web Part, if you make any changes to them (e.g., add a new brochure type), these will automatically appear in the Web Part.

Once this has been done, you can start adding more out-of-the-box functionality to the list. For example, you could set up an alert on the list so that members of the reception desk receive an e-mail when a new brochure request has been posted. They can then go to the item directly from the e-mail and send the brochure to the address specified by the site visitor. You could also have a “Brochure Sent” yes/no column created in the list that was exposed in a “Brochures to be sent” list view, so that reception workers can view outstanding items and confirm when a brochure has been sent to clear it from the list view.

Friday, 17 April 2009

Free (High Quality) Sharepoint Web Parts

This site has a few really handy Web Parts, but best of all, they’re free! They include:

  • Media Player Web Part which supports playing MP3, SWF (Flash), AVI, WMV, MP4, MPG, MPEG, YouTube and MOV (QuickTime) files from a SharePoint Library
  • Nice looking digital clock Web Part which displays the time in different zones.
  • Picture Lightbox Web Part
  • Flash rotator Web Part
  • Slideshow Web Part
  • And many more!

Great work from Amrein Engineering – if only others took their lead rather than charge for even simple Web Parts…

Free Sharepoint Web Parts

Tuesday, 7 April 2009

Launching desktop applications from a Web Part

If your looking for an easy way to create a Web Part which allows users to launch applications from a page on a SharePoint site, then it can be done with the Content Editor Web Part, as pictured below:

All you need to do is create some HTML tables and add the following hyperlink code to a cell in your table, copying your images wherever your image source code locates them:

<a href="javascript:LaunchApp('C:\\Program Files\\Microsoft Office\\Office12\\MSPub.exe')"><img alt="Launch Microsoft Publisher" src="images/PublisherIcon.jpg" width="54" height="54"></a>

You will also need to set "Prompt" or "Enable" for the "Initialize and script ActiveX controls not marked as safe for scripting" security option in Internet Explorer for the zone in which the portal is accessed. If this is an intranet, this should be fairly straightforward as your site should already be present in the "Local intranet" security zone, and more often than not controlled by a Group Policy. This is more difficult if your site is accessible as an extranet site because these machines a) may not trust the site and b) are quite often not controlled by a Group Policy. Obviously, this will relax the security for that zone in the browser, so do not modify this option unless you are sure about doing so.

I have uploaded the Web Part and images shown at the top of this article to the following location if you wish to have a look at or use my example -

Tuesday, 24 March 2009

Can't sign in to SharePoint with IE8 or IE7 - 0xc000006d errors

If like me you have SharePoint 2007 and Windows Server 2008 installed on the same computer for development purposes, you may find that you have problems signing into your SharePoint site once Internet Explorer 8 has been installed.

Update: This also appears to be happening on IE7 after the installation of recent Windows Update KB963027 - Thanks Virinder for the update.

The following errors appear in the Security Event logs:

An account failed to log on.

Security ID: NULL SID
Account Name: -
Account Domain: -
Logon ID: 0x0

Logon Type: 3

Account For Which Logon Failed:
Security ID: NULL SID
Account Name: phil
Account Domain: PORTAL

Failure Information:
Failure Reason: An Error occured during Logon.
Status: 0xc000006d
Sub Status: 0x0

Process Information:
Caller Process ID: 0x0
Caller Process Name: -

Network Information:
Workstation Name: PACSERVER
Source Network Address:
Source Port: 57620

Detailed Authentication Information:
Logon Process:
Authentication Package: NTLM
Transited Services: -
Package Name (NTLM only): -
Key Length: 0

The sign in request seemed to be trying to log me on using a domain name called PORTAL, which doesn't exist but is the NetBIOS name of my SharePoint site URL - portal.pacdomain.local. When I tried signing on using the DOMAINNAME\Username format, the logon failed with the same message in the event logs.

To resolve the issue, I followed the steps documented in the following article -, which seems completely unrelated to the issue I was having as it references a problem when using SQL Server 2008 Reporting Services.

Update: This issue is also discussed in the following Microsoft article -;en-us;896861

Thursday, 12 March 2009

Storing Site Metadata - The Easy Way

There are many scenarios where you might want to store metadata on a site - for example, if you are creating project team sites, you might want to attach the project reference number, manager, RAG status, etc. If you are into development, you can do this by writing to the site property bag, but if you're not, the easiest way I have found is to create a custom list on the site and add your site information to the first item in the list.

This is very easy to do, and of course users will be able to add the information using the standard list edit form in the UI and you can assign appropriate permissions for specific people to add this information to the site.

There is one request I have had from users though, and that is to show the metadata in a Web Part on the home page of each site and allow new sites to be created from a template which also show the metadata on the home page by default. Whilst not the biggest fan of SharePoint Designer, it does allow you to do this quite easily:

1. Create your list on the site (I have called it Project Information for this example)

2. Create the columns to contain the metadata that you wish to store

3. Add at least one item to the list - I usually populate it by populating the Title column value with "Complete these details for this project by clicking "Edit Project Information" in the left-hand navigation" and creating a link to the EditForm.aspx file in the Quick Launch.

4. Create a new Web Part page on the site as a temporary home for your Web Part.

5. Edit the Web Part page in SharePoint Designer, click Insert > SharePoint Controls > Custom List Form.

6. Choose your custom list in the drop-down box, select the "Display Item Form" and untick the standard toolbar option.

7. Delete any unwanted cells and rows from the table, and get it looking how you want it.

8. Save the page (this will mark the page as customised, but you are deleting later anyway).

9. Go to the Web Part page in the browser and export the Web Part to a file.

10. Go to the default.aspx file on the site and import the Web Part from the saved file.

11. Delete the temporary Web Part page (this was created to avoid you having to edit the default.aspx page - thus, marking it as a customised page).

12. Save the site as a template, remembering to tick the "Include Content" option so that the first item in the custom list is stored in the template.

13. Create a new site using the template - the site metadata will now be present on the home page.

Monday, 23 February 2009

Displaying SharePoint version information in Office documents

One thing I get asked for from time to time is to display the latest SharePoint version information in Office documents and templates. I have always found it easier to create new custom columns for this and populate them using an event handler.

Seeing as though I think this may be useful for others, I have uploaded some code and resources to Codeplex which provides this functionality. It comprises of two components:

- A site collection feature to deploy four new custom site columns for use in Content Types or document libraries where version information is to be shown in Office documents.

- A site feature which implements an event handler to populate the custom columns with version information for any document library present in the site, including the current version, when the document was last approved, who approved it, and when it was approved.

Once the custom column information is being populated by the event receiver, it can be shown in Office documents using the Quick Parts (Office 2007) or Fields (Office 2003 or 2007) features.

You can download the solution file, source code, and instructions at

Friday, 13 February 2009

Best Practices Resource Center for MOSS 2007

I think Microsoft has done a really good job with their Best Practices Resource Center for SharePoint Server 2007. It breaks down the main consideration areas and offers best practice tips in short bullet points with a link to show more detail. This site is a must-read for anyone involved in SharePoint solution architecture and development:

Thursday, 12 February 2009

Sign In Web Part

I have just added my Sign In Web Part to Codeplex. It's quite a simple Web Part really, but I have used it for a couple of customers who wanted to make the Sign In facility more prominent than the "Sign In" link in the top right corner of the page.

Once the user has signed in, the button will disappear and a message can be shown in its place, or if the authenticated message is left blank in the Web Part properties, no message is shown and the Web Part will appear invisible to the user.Both the button and authenticated message control can be customised with a CSS reference for styling, the dimensions of the button can be modified, and the authenticated message can be changed:

You can download it at

Monday, 9 February 2009

A-Z People Search in MOSS 2007

Whilst researching a requirement to provide people search results in a grid view, I came up with this solution using out-of-the-box MOSS Web Parts. It comprises of a new people search results page, Content Editor Web Part showing the A-Z links, and the standard People Results Web Part with changes to the XSLT to show results in a table view, as shown below.

Because it uses OOB Web Parts, you get the usual search refinement facilities on the left, and of course any federated or faceted search options that you may want to configure on the page. I have configured the XSLT so that you get the presence icon next to the person’s name, a mailto link for their e-mail address, and their profile page will open in a new window when their name is clicked. You can obviously change the XSLT to show extra columns if required.

I have uploaded the files mentioned to

Friday, 6 February 2009

List of default site definitions

This may come in handy for someone, so I thought I would upload it - It's a spreadsheet containing a list of all the default site definitions in MOSS 2007, including their Title, ID, and template reference:

Friday, 30 January 2009

Best practice on disposing SharePoint objects updated

Roger Lamb has added an excellent page on the MSDN site covering best practice around SharePoint object disposal, including links to the updated MSDN article and the new SPDisposeCheck tool, and a quick reference guide on the page itself.

Check it out at

Monday, 26 January 2009

"FatalError" appears during STSADM import routine and "Access Denied" errors occur when editing document or list item properties

One of my customers reported the message "FatalError: Value does not fall within the expected range" during the "Importing List Master Page Gallery" process when using the STSADM import command to restore an STSADM export file over a new site collection. Running the STSADM import routine a second time on the site collection successfully completes with no errors or warnings.

I have since discovered that this issue was present after the customer installed the Infrastructure Updates for SharePoint and is now fixed in the December Cumulative updates package.

However, they have also reported another problem after testing a site restored using the STSADM import routine. All existing document libraries and lists created before the export are fine, but if they create a new document library or list in a site collection restored using the import command and edit the properties of a document or list item, they receive the message "Access Denied" with the standard message asking them to sign in as another user - even if they are the site collection administrator.

I raised a PSS call regarding this issue and a hotfix is currently being developed to resolve it, although the hotfix will only fix new site collections restored using the import command AFTER the fix has been applied. Any existing site collections where the issue currently occurs will remain broken. The hotfix should be available in the next cumulative update release.