Posts tonen met het label SharePoint 2007. Alle posts tonen
Posts tonen met het label SharePoint 2007. Alle posts tonen

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.