Need a link to create a new document from an Office template?

Hi everyone!

I found this blog post the other day and you can’t imagine the thrill I felt ūüôā

This is something I have wanted to be able to do so many times and didn’t know how to, now I do and I want you to do as well.

As you can see (and read in the blog post) the saveLocation is set from where the template is located. I did a little change to route the save location to a place I decided. I also added a little change to wait until the page is loaded before the function is executed, always a good thing to do.

This is the original code:

<script type="text/javascript" src="/_layouts/jquery.min.js"></script>
<script type="text/javascript">
$( function () {
$("a[href$='.dot'], a[href$='.dotx'], a[href$='.xlt'], a[href$='.xltx']").attr("onclick", "").click( function () {
saveLocation = $(this).attr("href").split("/").slice(0, -2).join("/")
createNewDocumentWithProgID(window.location.protocol + '//' + + $(this).attr("href"), window.location.protocol + '//' + + saveLocation, 'SharePoint.OpenDocuments', false)
return false

and this is my modified one with a hard coded save location:

<script type="text/javascript" src="/Style%20Library/Scripts/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
$("a[href$='.dot'], a[href$='.dotx'], a[href$='.xlt'], a[href$='.xltx']").attr("onclick", "").click( function () {
createNewDocumentWithProgID(window.location.protocol + '//' + + $(this).attr("href"), makeAbsUrl('http://MyIntranet/sitename/sitename/librar%20name'), 'SharePoint.OpenDocuments', false)
return false

Here is another one that prompts to save the document in the logged in users local Document library.

<script type="text/javascript">
$("a[href$='.dot'], a[href$='.dotx'], a[href$='.xlt'], a[href$='.xltx']").attr("onclick", "").click( function () {
createNewDocumentWithProgID(window.location.protocol + '//' + + $(this).attr("href"),'C:\Users\{login}\Documents' , 'SharePoint.OpenDocuments', false)
return false

As always when we are working with jQuery you have to make sure that you reference the location of that .js-file



Add customizable information to a library page

Hi everyone!

As you know when you add a web part to a library page, like Allitems.aspx or a page of a custom view that you’ve made, the ribbon gets wacky. That’s because it doesn’t know which web part it should have its focus on.

So what could we do if we really want some information, let’s say above the library web part?

And the information should be able to edit in an easy manner without using SharePoint Designer (SPD).

In this example I have a top site and underneath this I have some sub sites that are created from a site template I made. The things we are going to do now is made to that template so it could be reused.

First of all we have to edit the page’s code a bit, so bring¬†up the page in your favorite editing tool SPD!

Find¬†where the web part zone for the library begins and add two DIV’s right¬†before it starts, like this:

PlaceHolderMain" runat="server">
<div id="success"></div>
<div id="error"></div>
<WebPartPages:WebPartZone runat="server" FrameType="None" ID="Main" Title="loc:Main">

As you can see I have added two DIV’s right after PlaceHolderMain¬†with the ID’s of¬†success and error. Don’t close this page, we are coming back here real soon.

What we are going to do now is to add some content to the success DIV.

First we need to have some content, right?

On the top site, let’s create a new Web Part Page, call it content.aspx and choose Full Page, Vertical.

Add a Content Editor to the page, click inside it, choose to Edit¬†HTML Source…

…and paste this code:

<div id="<span class=">MyDiv"></div>
The content within this DIV will be shown above the document library.
<li>To think about...</li>
<li>And this as well...</li>

Ok, so now we have som content and as you can see the content is kept inside a DIV with the ID of MyDiv.

Now we are going back to the first page (where we have the library¬†and added the two DIV’s) to add this information to the success DIV.

Let’s¬†add som jQuery!

Find AdditionalPageHeader and add this code:

<asp:content contentplaceholderid="PlaceHolderAdditionalPageHead" runat="server">
 <SharePoint:RssLink runat="server"/>
<script type="text/<span class=">// <![CDATA[
javascript</span>" src="/sitename/Shared%20documents/jquery-1.6.2.min.js">
// ]]></script>
<script type="text/javascript">
 $(document).ready(function() {
 $("#success").load("/sitename/sitename/SitePages/content.aspx #MyDiv",
 function(response, status, xhr) {
 if (status == "error") {
 var msg = "Page is missing: ";
 $("#error").html(msg + xhr.status + " " + xhr.statusText);

As you can see, first I have a reference to my jQuery file, you should replace the URL so that it corresponds to your environment.
Then in the next section we are loading the content in MyDiv into the DIV with the ID of success.

Now we are done!

Save all pages and try it, it should look something like this:

This way you can create new sites from this site template and just by editing the Content Editors in the page content.aspx you could update the contents on all sites.

Isn’t that nice?



Custom Meeting workspace site template

In a project I recently worked in I found out the hard way that it wasn’t possible to save a Meeting workspace (MW) as a custom template to recreate sites from. I also found out through Bing that I wasn’t alone in my discovery ūüôā

The other day I was discussing this with a colleague and by reproducing it I wanted to show him that the left navigation on the site between the different meetings would crack.

So I saved a MW as a new template and from that template I created a new MW from a calendar event. Then I created another calendar event and linked to the same MW. Navigating to the MW I could now see the two dates in the left nav. And do you know what? It worked!

I could actually navigate between the two dates! This has never worked before!

So why does it suddenly work?¬†SP1 for SharePoint 2010 ūüôā

My colleague who did not have SP1 installed, doing the same thing in his dev environment, got the old behavior, left navigation cracked. After installing SP1 he didn’t have the problem any longer.

Isn’t that great? When SP1 was released I actually went through the Excel file with all the fixes and couldn’t find anything about this. I wish it could have been mentioned, it would have saved me and the client a lot of time.

Another thing to be aware of when you have meeting workspaces in a site collection and you for that site collection, wants to push out a custom master page on all sub sites. If you do that, the MWs will also be getting your custom master page. As you already might know, MWs have their own master page.

The result you will get by doing this is that (again) the left navigation will crack. You will get a JavaScript error telling you that a property bag is missing.

To fix this you will have to add this into your custom master page.

At the top add this Tagprefix:

<%@ Register Tagprefix=”Meetings” Namespace=”Microsoft.SharePoint.Meetings” Assembly=”Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
Below the FORM-tag below the BODY-tag add:

<Meetings:PropertyBag runat=”server”/>

There is one more thing to add to this. In a MW there are two more options in the Site Actions menu.

“Add Pages” and “Manage Pages”. These two options will also be lost when you apply another master page than the default for a MW. I don’t have a solution for how to handle that as for now. But some how I think it’s needed to make the Site Actions menu dynamic and show these options only if the site is created from a MW template.