donderdag 19 januari 2012

Recently, a client asked me to modify the search results look of their SharePoint environment. Instead of having the default search results slightly modified;
  • adding a new item link allowing to open the item
  • adding a link directing to the location where the result comes from
  • removing the default URL which is shown at the bottom of a search result
Adding a new item link
Let's start easy with creating a link to the item. This is actually just creating an href tag:
  <a href="{url}">Open file</a>
The {url} reference is the default shown at the bottom of the result, as well the link used when you click the result title.

Adding a link to the parent location
Now, this supposed to be an easy one; add something like the url and that's it... But in vain... So I resorted to two methods; using data view web part and using the raw xml. Assuming that I would have to dig deep, I went on and used the data view web part. The two best options to use were 'Path' and 'FileDirRef'. Unfortunately the FileDirRef gave me no results, and the 'Path' always showed me the parent location of the results.aspx page.
So on to the next option; using the raw xml.
How does this work;
  • you have xml-values coming in
  • you style these using the xsl
  • using the raw xml styling, you can get the actual values coming in (and thus verifying if all values are found). Use following xsl to get the raw XML (don't forget to save the original xsl... just in case).
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xmp><xsl:copy-of select="*"/></xmp>
</xsl:template>
</xsl:stylesheet>

I was a bit astonished about the results... all of a suddon, within the xml results, there was a field called 'sitename'... but the value was exactly what I needed... the location where the item came from.
Thus, on to the next step... creating the link:

  <a href="{sitename}">Open file Location</a>


Removing the original URL
And to finish... an easy one on the removal of the original URL. Look for following code in the xsl sheet, and remove the italic part:

<p class="srch-Metadata1">
<span><span class="srch-URL2" id="{concat($currentId,'_Url')}">
<xsl:choose>
<xsl:when test="hithighlightedproperties/HHUrl[. != '']">
<xsl:call-template name="HitHighlighting">
<xsl:with-param name="hh" select="hithighlightedproperties/HHUrl" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="url"/>
</xsl:otherwise>
</xsl:choose>
</span>
<xsl:call-template name="DisplayCollapsingStatusLink">

voila, that's it... enjoy playing with the xsl... gonna add some screens tomorrow

donderdag 25 augustus 2011

Linking to Lotus Notes DB from within SharePoint

Strange, for years I managed to stay away from Lotus Notes... but lately I'm being sucked in to the vortex.

Biggest thing which annoys me, is that it's not that easy to link to a Lotus Notes DB from within SharePoint. Take following example;
  • a customer comes to you and says: "hey, I don't like Notes anymore... give me some SharePoint"
  • you're like "ok, with pleasure"
  • and then you realize that it will take some time to get everything over to SharePoint... so you'll need a way to create links between the two platforms.
What's the main problem here? Well, SharePoint only likes the default prefixes in URL's; such as HTTP, FTP, ... nowhere in the list you'll find 'notes://'. If you're like me, then you've already tried to enter the notes-link no matter what SharePoint is telling you... and you'll have noticed that it doesn't work (you'll get an 'invalid URL' message).

Luckily, there is a way to get around this (there are a couple of them... but this is the easiest one IMHO):
You will need:
  • a link to a notes-DB
  • a page in your site (web part page)
Follow these steps:
  • go to your web part page
  • add a 'content editor' web part
  • edit the content editor web part and select the 'Source' option (not the RTF-editor!)
  • paste following in the editor:
<A href="link to your notes-DB" target=_blank>Link to my notes location</A>
  • then save and click OK in your web part tool pane
Congratz... you've got yourself a link to a Notes DB (that works and isn't that hard to create).

For those looking for a more development angle for creating notes-links in lists; check this link.

donderdag 28 juli 2011

Define how a file on SharePoint opens when clicking a link

It has been a while since I last had following issue:

A user gets a mail in which there is a link to a document on SharePoint (2007 in this case). On most PC's the file opens nicely in the needed Office application... however, on some PC's the file opens in the browser.

What's the solution?
Well luckily, this is something which seems to happen often, so google soon brought me to the right location:
http://www.shaunakelly.com/word/sharing/opendocinie.html (Tnx Shauna).
So, the user has to indicate that he/she does not want 'browse in same window'... and it'll fix the issue.

Reason:
The link you get in a mail refers to the SharePoint site on which the file is stored. Because it's on SharePoint, the first thing the link does, is to open SharePoint (in the browser) to get the file details (such as location in the database). As a second step, it will open the word file... and with the 'browse in same window' checked, that means it will open in the internet explorer window.

vrijdag 11 maart 2011

Document libraries and multiple lines of text column

Within SharePoint, document libraries offer a vast array of possibilities to work on and with documents. There are some limitations, one of which is the use of the multiple lines of text column.

This issue has been discussed for articles by Bart. Now, the same issue is also valid when you want to work with Word-documents. Let's take an example;
  • you've got a very nice document template in which users are allowed to enter a title and a description
  • in reality the description part of the template is a SharePoint column which has been added into the template using the quick parts
  • users like to type long descriptions (ok, not all of them are like that... but nevertheless), so they could easily pass the 255 character limit of the description field
  • Word will allow you to keep on typing, it's only when you try to save the document to SharePoint that you get the message that long texts aren't accepted.
Luckily, there is a way to work around this !
As stated in the blog of Bart, you can create a column of the type Multiple lines of text, and make sure that you select the option "Allow unlimited length in document libraries". The moment that you activate this option, you'll get a warning that using the option could result in data loss... never mind this for the time being.

Next step is to use the field as quick part in a template and to test it out by typing a very long text. Depending on your Word-version, you'll get one of following results:
  • everything works like a charm => you're probably using Word 2010, don't you
  • when trying to save, you get either an error message, or in the document information panel you get a dotted line around the multiple lines of text field => this means that you are using an older version of Word
By using this option, the character limit of 255 doesn't count anymore, and you can enter whatever number of characters you want. I've tested it up to 62.000 characters (spaces included).

woensdag 2 februari 2011

What to expect...

Until now, I haven't had the need to blog about things... as if anyone would want to read my stuff :).

But things change, and even I change... so the inevitable happened... I wanted to start a blog. This won't be a blog about personal stuff, I won't write about financial things, not even politics. I am going to share things related to SharePoint with you, experiences, problems (and maybe even answers), and so on.

I hope you will enjoy the ride...