Create a nicer looking hyperlink instead of the full URL using simple HTML

Perhaps it is just basic HTML, but I’m positive that this will benefit someone while formatting for example a workflow email.

Instead of having that ugly long URL inside the body of the email, we would like to have some text that says “Click here” to link to the appropriate document / list item etc.

A hyperlink is simply created by typing the following code in  the body of your email:
<a href=”http://MyServerName/”>Click here</a>

Replace the http://MyServerName for some item you would like to link to.

Pretty much all email clients will read the html code and convert it into a nice looking link.

“The template you have chosen is invalid or cannot be found” – Solution

When you receive the error “The template you have chosen is invalid or cannot be found.”  while creating a new site based on a template most likely there are features used in the template that you don’t have in your installation of WSS or MOSS.

This could be because they are simply not activated or because the specific flavor of WSS or MOSS has more features than you have.

Resolving this issue is actually quite easy when you follow the steps described below:

  • Download the STPInspector from: http://stpinspector.codeplex.com/ (we will use the STP Inspector to analyzes the site template file (.stp) and show its dependencies on the site features and site collection features).
  • Install the STPInspector preferably on the server where your installation of WSS or MOSS resides so it can cross reference the site template file’s features against the features available on the server.
  • Download the Microsoft Cabinet Software Development Kit (CABARC) from http://support.microsoft.com/kb/310618 (we will use cabarc for creating a cab file again after we have made modifications to the original manifest.xml file).
  • Create a folder on your c:\ drive called cabarc and extract the files from the executable in there (the name is only important if you want to follow this article by the letter).
  • Create a new folder on your c:\ drive called MySiteTemplateName.
  • Rename your site template file (.stp file) from for example mysitetemplate.stp to mysitetemplate.cab
  • Double click the mysitetemplate.cab file and copy the contents to the folder you just created on your

Making the “Encoded absolute URL” work with a list in SharePoint

You’ve probably noticed that when trying to use the “Encoded Absolute URL” in for example an email that gets sent out from a workflow on a SharePoint list, returns a strange link that doesn’t work when clicking on it.

The URL that gets created when using the “Encoded Absolute URL” looks something like: http://litwaredemo/Project/Lists/Projects/14 .000.

The catch with the “Encoded Absolute URL” parameter is that it only works with Document Libraries – not with any other lists in SharePoint.

There are a couple of easy way around this by changing the URL a bit.

  • Option 1 is the best approach, however you will have to hardcode the server name and this could cause the workflow or other to break when you move servers / domains (not very likely to happen very often though).
  • Option 2 is a straight forward approach which doesnt’ make it necessary to hardcode the server name however has the downside that it will NOT work when using folders inside the list where list items are located.

Option 1: Hard coded server name – best option

When you created a workflow and as an action kick off an email, you can use the “Add Lookup to Body” functionality to compile the link.

In the body of the email type in:
http://YOURSITENAME/

  • Click the “Add Lookup to Body” button
  • For the drop down list “Source” select “Current Item”
  • For the drop downlist “Field” select “Path”
  • Click “OK”
Current Item > Path

Current Item > Path

Now the URL in the email body will look like:
http://YOURSITENAME/[%Tasks:Path%]

  • Enter the text ”/DispForm.aspx?ID=” behind the just inserted parameter
  • Click the “Add Lookup to Body” button again
  • For the drop down list “Source” select “Current Item”
  • For the drop downlist “Field” select “ID”
  • Click “OK”
Current Item > ID

Current Item > ID

Now the URL in the email body will look like:
http://YOURSITENAME/[%Tasks:Path%]/DispForm.aspx?ID=[%Tasks:ID%]

Proper path to SharePoint list item

Proper path to SharePoint list item

 The email that will send out when the workflow is triggered will now look like:

Email with link to list item

Email with link to list item

Option 2: Using [%Tasks:Encoded Absolute URL%]

When you created a workflow and as an action kick off an email, you can use the “Add Lookup to Body” functionality to compile the link.

In the body of the email:

  • Click the “Add Lookup to Body” button
  • For the drop down list “Source” select “Current Item”
  • For the drop downlist “Field” select “Encoded Absolute URL”
  • Click “OK”

Now the following parameter in the email body will look like:
[%Tasks:Encoded Absolute URL%]

  • In order to get a working link we will have to add “/../DispForm.aspx?ID=” behind the just inserted parameter
  • Click the “Add Lookup to Body” button again
  • For the drop down list “Source” select “Current Item”
  • For the drop downlist “Field” select “ID”
  • Click “OK”
  • Now the link in the email body is complete and will look like:
    [%Tasks:Encoded Absolute URL%]/../DispForm.aspx?ID=[%Tasks:ID%]

    The trick is the /../ between the “[%Tasks:Encoded Absolute URL%]” and the “DispForm.aspx?ID=[%Tasks:ID%]” in the link. The “/../” tells the server to go up one level in the folder hierarchy. The problem with this approach is that when you have folders inside your list where you store list items the path to the needs to go up even more levels depending on how deep you nested the list items.

    I recommend using option 1 – but if you are absolutely certain folders will never be used or you will always keep all tasks organized on one specific folder level – this option will be ‘ok’.

    And we are done!

    See our follow up post about creating a nicer looking hyperlink instead of the url.

    Hope this helps!

    Export a SharePoint site as a Site Template (.stp file)

    In SharePoint it’s easy to export your site as a site template and create new sites based on it.

    The site template will save the structure of the site designed in SharePoint Designer, so other sites you create based on the template will have the same structure (optionally you can even include the content!).

    Export a site as a site template using the SharePoint interface.

    • On the specific site you would like to save as a template go to Site Actions → Site Settings;
    • Go to the Look and Feel menu and click Save site as template;
    • The SharePoints administration page “Save Site as Template” will open up from which you can save your site as a template file (.stp). You also have the option to include content which will include the contents of all lists and document libraries in the selected site.

    Export a site as a site template using SharePoint Designer

    • Open the specific site that you would like to save as a template;
    • File → Export → Sharepoint Site Template;
    • The SharePoints administration page “Save Site as Template” will open up from which you can save your site as a template file (.stp). You also have the option to include content which will include the contents of all lists and document libraries in the selected site.

     

    Save site as Template

    Save site as Template

    A few words about included content

    Include content in your template if you want new Web sites created from this template to include the contents of all lists and document libraries in this Web site. Some customizations, such as custom workflows, are present in the template only if you choose to include content. Including content can increase the size of your template. There is a maximum file size of 10MB  for the template file.

    Caution: Item security is not maintained in a template. If you have private content in this Web site, enabling this option is not recommended.

    To learn how to upload and use the template file (.stp),  please read our article: Upload and use a site template (.stp) in SharePoint

    Upload and use a site template (.stp) in SharePoint

    Log on to SharePoint as an administrator to the site collection where you want to upload the template. Make sure to browse to the top level site of the site collection.

    • Click the Site Actions button → Site Settings → Modify All Site Settings

    ModifyAllSiteSettings

    • Go to the Galleries section and select Site templates.

    SIteTemplateGalleryUpload

    • On the Site Template Gallery page, select ‘Upload’ or ‘Upload multiple documents’
    • On the Upload Template: Site Template Gallery page, browse to the .stp file and click OK to upload the file.

    UploadTemplate

    • You have now succesfully uploaded the file and are ready to use it.

    Creating a new site based on the uploaded Template

    • Log on to SharePoint as an administrator.
    • Go to the site under which you want to create a site based on the newly uploaded template.
    • Go to Site Actions → Create Site

    Create Site

    • On the next page “New SharePoint Site” fill in the field and pick the new template from the ‘Select a template’ section.
    • You will find your template under the tab ‘Custom
    • Click Create, and now a site based on the uploaded template will be created.

     

    To learn how to export a SharePoint site as a template file (.stp),  please read our article Export a SharePoint site as a Site Template (.stp file)

    Microsoft Office SharePoint Server vhd

    We thought it might be helpfull to post a link to the Microsoft Office SharePoint Server 2007 VHD. We use this for a lot of our tutorials, testing and demo’s since it comes fully loaded with all the software we generally need.

    http://www.microsoft.com/downloads/details.aspx?FamilyID=67f93dcb-ada8-4db5-a47b-df17e14b2c74&displaylang=en

    For other vhd’s you can go to http://www.microsoft.com/vhd

    You can run the VHD (virtual hard disk) with virtual pc, virtual server or Hyper-V.

    The paste text dialog box

    The Paste Text dialog box  in SharePoint Designer contains a few formatting options that allow you to paste text from other sources into your page.

    In this article we’ll explain what each option does.

    • Plain text ~ Pastes all text but replaces line breaks with spaces.
    • One <pre> formatted paragraph ~ Pastes all text within a single preformatted text <pre> tag
    • Many <pre> formatted paragraphs ~ Pastes each paragraph into seperate <pre> tags.
    • Normal paragraphs with line breaks ~ Pastes all text within a single paragraph tag.
    • Normal paragraphs without line breaks ~ Pastes each paragraph into a seperate paragraph tag.

    Paste or Paste Text

    • The paste option copies text along with the markup and styles (BAD!).
    • The Paste Text option launches the Paste Text dialog box, which pastes it without any markup an styles (GOOD!).

    Always try to use the Paste Text to prevent getting garbage markup styles polute your webpages which can be a tedious job to clean up.

    You can find the Paste Text option in SharePoint Design by clicking Edit → Paste Text.

    Add a new subsite using SharePoint Designer

    You can add a new subsite to your site collection using SharePoint Designer

    • Start SharePoint Designer
    • Select File → Open site (choose the site collection you want to open)
    • Select File → New
    • On the Dialog box that opens click the tab Web Site
    • Click on the link SharePoint Templates on the left and the list of available subsites will populate on the right.

    In case the SharePoint Templates don’t show up right away, ensure you enter the correct url in the box “Specify the location of the new Web site

    When creating the subsite you will have to specify the location for the new Web site.

    This could be something like: http://litwaredemo/MyNewBlog.

    Add a site with SharePoint Designer

    Add a site with SharePoint Designer

    Security settings for a subsite

    By default all subsites within a site collection inherit the same administrator settings set for the site collection (top-level site). You can change the administrator settings for each of the subsites seperately from the top-level site.

    What is a site collection

    We often get asked the question “what is a site collection” and “what is a subsite“.

    Simply put: a site collection is a top-level website with one or more subsites.