Remember that the XSLT select is case sensitive...

I was customising a people search result web part this week and couldn't figure out why the mobile phone field was not rendering in the results. I could see it was in the AD properties, was making it through user profile import and then helped it through to managed metadata in the search results, I even checked the raw XML for the search results which showed it there as well. So I was down to checking my XSLT, I had camel cased the name of the field in my select code, as is my habit with coding to make it easily readable, but the XSLT was looking to match the case returned by the search results which was all in lower case.

A quick crrection and refresh and they all appeared as they should. Another little puzzle solved...

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Crawling Exchange 2003 Public Folders on SBS 2003 from Moss 2007

Setting this up for the first time was a little challenging. I couldn't figure out why no matter what combination of settings and credentials I gave the search service it wouldn't crawl the public folders. I tried crawl rules, complex URLs, content access accounts, but eventually I gave up focusing on SharePoint options and started to look more closely at what was happening at the other end - what was exchange doing?

I had already checked the IIS settings for the public virtual directory and it showed that Basic and Integrated Windows Authentication were both enabled, so I next tried to hit the public folders URL with it in my local intranet zone so that windows would pass through my credentials automatically - just like we set up SharePoint all the time. Anyhow, I realised that no matter what I did with the IIS settings I couldn't get to the page without first entering my credentials on a form based login for OWA. I googled some more to find that although I was setting the authentication options in IIS, there are some additional settings in Exchange System Manger.

If you open ESM, then expand Servers, <server name>, Protocols, HTTP, you'll find the exchange virtual server, if you right click on the virtual server and select properties on the second tab there is an innocuous little box that says "Enable Forms Based Authentication".

So it didn't matter what I did in IIS Manager because it was overridden by the settings here. Well, someone helpfully pointed out in a forum that you can in fact create a second virtual server and set that to work without Exchange FBA. Yay! That's what I need, our existing users can keep their interaction the same on the current URLs, we'll create a new virtual server and set that not to use Exchange FBA, just Windows Integrated authentication and hopefully our crawl will work fine.

So the crawl has reached the end and 18,224 items are indexed and searchable in milliseconds. Lovely. I just need to make sure I've put all the settings back how they should be (you did make a note of all those changes you made as you fiddled in IIS, Exchange & SharePoint didn't you?) and once I'm happy that the URLs are accesible in the right places the job's done.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Caught out by the loopbacks again!!!!

Building a server today, I got caught by the loopback problem.

The search crawl logs don't index content and give a misleading

<message>

'Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled. (The item was deleted because it was either not found or the crawler was denied access to it.'

</message>

The support article by Microsoft will resolve this

This was annoying because the same thing caught me last time - and again I went looking at policies, permissions....argh!

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

MOSS Search not crawling beyond the first page of a site...

Working on a new intranet site for a client I was puzzled when only the homepage of the root site collection would appear in search results. We have site collections on managed paths below the root site and those weren't showing either. Crawls were running but the crawl log showed "Some parts of this document cannot be accessed". I checked the sharepoint logs and the windows event log, then googled away as usual but there weren't really any further clues, everything seemed to be as it should be.

I tried a reset all content on the search index and this made no difference, next up I tried a new content source as I had I noticed some blogs and forums had mentioned an error meessage saying

The start address http://intranet/sites/sitename is not valid for this content source type.

So I tried creating a content source of SharePoint Sites pointing at the site collections on managed paths, these also gave this message - Ah!, progress I thought as it gave another clue. But alas, no further clues were to be found. In the absence of any further hits on google revealing an insight that would solve it. I tried a restart on the Search Service and the Timer service followed by a full crawl. And straight away the crawl log started to give me more than just one hit on the new location, by the end of the crawl there were all the results I had been expecting first time round.

The only thing I can think confused it was that we recreated the site collections several times during deployment and that caused it to get confused.

I hope that little gem helps you out of a spot if search isn't bringing back the results you're expecting.

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Moss Search results pages are consistently inconsistent in returning slowly!

I've just completed a migration from SharePoint Portal Server 2003 to shiny new Moss 2007 implementation. And whilst looking for some content that had gone missing, I noticed that the search results page sometimes took 30 - 60 seconds to return the next page in the result set, whilst on other occasions it came back very quickly. My first thought was perhaps it's busy, all those users making lots of use of it! But no, processor usage on the boxes was all negligible.

As I explored this some more I discovered that it was consistently inconsistent! By which I mean that the first page of a particular query always came back quickly, the second slow, the third and fourth quickly, then the fifth slow and so on.  I think that's a quick step ( - I've been subjected to too much strictly come dancing), anyhow some digging around eventually showed up the following message in the logs:

 12/08/2008 22:32:19.57  w3wp.exe (0x1134)                        0x0EC4 Search Server Common           MS Search Query                0 High     Exception while finishing web request or starting web page read on http://search.live.com/results.aspx?q=safety&count=3&first=1&mkt=en-GB&format=rss&FORM=SHAREF: System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host 194.217.240.73:80     at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)     at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)     --- End of inner exception stack trace ---     at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)     at Microsoft.Office.Server.Search.... 
12/08/2008 22:32:19.57* w3wp.exe (0x1134)                        0x0EC4 Search Server Common           MS Search Query                0 High     ...Federation.HttpAsync.RespCallback(IAsyncResult asynchronousResult) 

and

12/08/2008 22:27:35.20  w3wp.exe (0x1134)                        0x0EC4 Search Server Common           MS Search Query                0 High     Exception while finishing web request or starting web page read on http://search.live.com/QSOnly.aspx?q=safety&count=3&first=1&mkt=en-GB&FORM=SHARES&format=rss: System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host 194.217.240.71:80     at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)     at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)     --- End of inner exception stack trace ---     at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)     at Microsoft.Office.Server.Search.F... 
12/08/2008 22:27:35.20* w3wp.exe (0x1134)                        0x0EC4 Search Server Common           MS Search Query                0 High     ...ederation.HttpAsync.RespCallback(IAsyncResult asynchronousResult) 

I thought it a bit strange that a federated search was being performed as there were no federated search webparts on the results page I was looking at. Anyhow it seems that by default the federated searches at Microsoft's live.com are run anyway... disabling these federated search locations in Search Administration > Federated Locations instantly gave me nice quick results all the time.  Well disabling - I added a prefix that's unlikely to get used as I thought they might come in useful when Microsoft has fixed the delay!

If you find another solution - please add a comment to let me know. Thanks.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

A ‘Whats New’ web part

A recent prototype involved creating a ‘Whats New’ web part. This was required to display a total of the new of recent new content and the latest 5 items.

We had a number of options when creating this, but we chose to build it quickly using SharePoint Designer and the Search web service.

Before we start, a note on the use of SharePoint designer.
There is a lot of debate about when (or even if) this tool should be used, but for me it is a great tool to write xslt and transform web services. It can do a heck of a lot even before you start jumping in and typing xslt. I use it on development servers only and export the created web part. If you want to use designer on your live servers then please research and understand the implications of ghosted / unghosted pages.

OK – our webpart. The key to this prototype is the SharePoint search webservice. In this case, I’m using search.asmx (the MOSS search) rather than spsearch.asmx.

Why use search.asmx?

Our prototype (and many client implementations) are comprised of multiple site collections. Becuse of this, out of the box tools like the Content Query Web Part or 3rd party tools like Jan Tielmans ‘Whats New’ part wouldn’t help us as they only work across the current site collection.
Another thing to note – using search.asmx means we are getting security trimmed results – you are only seeing new items that you have access to.
I’m assuming that readers of this will know and understand how to open pages, add data sources and the basic principles of XSLT
In designer, our first task is to hook onto the search service. It’s accessed via the URL ‘http://<portal>/_vti_bin/search.asmx. For details on the service, look at http://msdn.microsoft.com/en-us/library/ms470518.aspx. We are adding a WebService datasource. Check out http://office.microsoft.com/en-us/sharepointdesigner/HA101171541033.aspx  for details on doing this

Once accessed, we are going to use the QueryEx method. There is a similar Query method that will return an XML formatted result packet, but QueryEx will allow us to work with the resulting dataset inside Designer.

After connecting, we have to pass our search query (the QueryXML property). We can pass a complex SQL (http://msdn.microsoft.com/en-us/library/bb219479.aspx ). In our case, we are going to ask for all content created within the last 7 days.

The query we used was...

[code:xml]

<QueryPacket xmlns="urn:Microsoft.Search.Query" Revision ="1000">
<Query domain="QDomain">
<SupportedFormats>
<Format>urn:Microsoft.Search.Response.Document.Document</Format>
</SupportedFormats>
<Context>
<QueryText language ="en-US" type ="MSSQLFT">SELECT Rank, Title, Path, Author, Write, WorkId, Size, Description, SiteName, CollapsingStatus, ContentClass, IsDocument, HitHighlightedSummary, HitHighlightedProperties FROM Scope() WHERE Write > DATEADD(DAY, -7, GETGMTDATE())</QueryText>
</Context>
</Query>
</QueryPacket>

[/code]

An important note – the QueryXML property is a complete XML string, we can’t just pass the query itself. The string above has been split across multiple lines to adi readability but when entering we have to enter as a single row

Once input, click on the DataView and choose Show Data.


 
If all is well, we should see a dataset result, similar to the screen below. Note – if there is no new content, no results!

Now we have the data, we can quickly build our webpart.
Firstly, click in a webpart zone on the page and add a basic DataView using the fields TITLE, WRITE and DESCRIPTION.
I now changed some properties. I changed the layout to the second option (rather than the default row/column view).

We also changed the sort options to sore by WRITE (so we are showing the latest content in date descending order)

Parameters

I added some parameters to make adding to other servers slightly easier. These were for More Details link, images path, maximum number of items etc as seen below

Showing the number of new items...
In the <xsl:template name="dvt_1"> template, I added a new row and inside the row put the following....

[code:html]

<tr>
<td valign="middle">
<div class="wpTitleZone" style="width:236px; height:35px;   background-color:#ccc; background-image: url({$ImagePath}/blueTitle1.gif); background-repeat: repeat-x">
<a class="TitleZone" href="{$MoreDetailsLink}">
<div class="TitleZone" style="width:236px; height:35px;   text-align: center; line-height:35px;  cursor: hand; background-image: url({$ImagePath}/iconBlue1News.gif); background-repeat: no-repeat; background-position: left center;">
<xsl:value-of select="$TitleText"/>
</div>
</a>
</div>
 </td>
</tr>

[/code]

Showing Icons

The next change was to include the icons to represent the type of content. These icons are those used in standard search results.
Inside the <xsl:template name="dvt_1.rowview"> template, we added the following....(extract only)

[code:xml]

<xsl:choose>
<xsl:when test="CONTENTCLASS = 'STS_Site'">
 <img>
   <xsl:attribute name="src">
   _layouts/images/<xsl:value-of select="CONTENTCLASS"/>16.gif
  </xsl:attribute>
  </img>
 </xsl:when>
<xsl:when test="CONTENTCLASS = 'STS_Web'">
<img>
<xsl:attribute name="src">
_layouts/images/<xsl:value-of select="CONTENTCLASS"/>16.gif
</xsl:attribute>
</img>
</xsl:when>
<xsl:when test="CONTENTCLASS = 'STS_Document'">
<img src="_layouts/images/html16.gif"></img>
</xsl:when>
<xsl:when test="contains(CONTENTCLASS,'ListItem')">
<img>
<xsl:attribute name="src">
_layouts/images/<xsl:value-of select="substring(CONTENTCLASS,1,12)"/>16.gif
</xsl:attribute>
</img>
</xsl:when>
<xsl:when test="contains(CONTENTCLASS,'_List_')">
<img>
<xsl:attribute name="src">
_layouts/images/<xsl:value-of select="CONTENTCLASS"/>16.gif
</xsl:attribute>
</img>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="displayTitle" select="substring-after(CONTENTCLASS,'_')"/>
<img>
<xsl:attribute name="src">
_layouts/images/<xsl:value-of select="CONTENTCLASS"/>16.gif
</xsl:attribute>
</img>
</xsl:otherwise>
</xsl:choose>

[/code]


From this you should see that we are interrogating the CONTENTCLASS property and mapping an image to it. Again, this is similar to search and fortunately, there are a lot of icons that map direct to the CONTENTCLASS

Formatting the title and update date

We format the title as a link. This is a simple xslt in the format of

[code:xml]

<a href="{$MoreDetailsLink }"><xsl:value-of select="TITLE" /></a>

[/code]

 we are using the $MoreDetailsLink parameter for the URL and the Title for the display text.
For the date, we are applying the DD-MMM-YY hh:mm format using

[code:xml]

<xsl:value-of select="ddwrt:FormatDateTime(string(WRITE) ,1033 ,'dd-MMM-yy hh:mm tt')"/>

[/code]

For both of the above, you can get Designer to do this for you. Right click the text you want to format and then you can choose the format options –e.g. hyperlink, datetime etc.

We set the properties of the DataView web part to set the maximum number of items to 5, then in the opening of the XSLT we set

[code:xml]

<xsl:variable name="RowLimit" select="$NumberOfItems" />

[/code]

you can see we are setting the maximum number of items to a parameter value. We do this so that we only need to modify parameters in the Web UI rather than asking administrators to open the XSLT in future.

Finally, in the template, we added another row to link to a more details page.

[code:xml]

<tr>
<td class="ms-vb">
<a href={$MoreDetailsLink}>See All New Items...</a>
</td>
</tr>

[/code]

This is our prototype linked to a page that contained as similar web part, but was showing all results and had pagination etc.

You can download a version of the prototype web part here. As always, be aware that this is a prototype and the normal disclaimers apply (e.g. make sure this web part goes through a code review before putting onto a production server).

 

Whats_New.zip (3.65 kb)

Currently rated 4.0 by 3 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Displaying raw XML on search results

Quite often you will need to customise the search results and ensure that your custom metadata mappings are displaying correctly.

To view the raw results, I undertake the following...

a) Edit the results page (results, or people depending on what you are looking to modify

b) Add a new core results web part (again people or results)

c) Add your columns, fixed queries etc

d) Click the Edit XSLT button and replace the XSLT with the following

[code:xml]

<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>

[/code]

Save everything and you can now see the raw results.

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Displaying a Single Users Profile Details

Following the previous post on search, this shows how to simply and quickly show a single users profile details on a page. Note, that this intended for MOSS (where we have the profile database) but could be re-worked for WSS to show details from the user list.

On our page, we need to add the People Search Core Results Part

 

Once added, open the web part properties so we can configure the part. We need to make several changes....

a) Under the Results Display / View group, set the Results Default View to Relveance and Results per page to 1

b) Under the Results Query Options group, change the Cross Web Part Query ID to Query 2 (see also note below)

c) Under the Miscellanous group, uncheck all the options except  Show Search Results

d) Finally, in the Fixed Keyword Query option, enter the query required (e.g. LastName:Piper)

Save the changes.

The final result will be basic details from the profile databse about our user

If the appearance needs to be changed, then you can edit the XSLT (another future post I think!) to suit.

Note - you may need more than one profile - in this case, the Cross Web Part Query ID needs to unique for each part on the page.

If you have more than 3 user profiles to display, then consider using different queries to get multiple results. For example, to show all users who have the property Department:Sales to show all sales members. If doing this, the number of search results should be increased from 1!

Currently rated 5.0 by 3 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Rolling up data inside Sharepoint, using Search

The recent platform update to WSS and MOSS has bought into play Search Server 2008. Whilst very powerful on it's own. it allows us now to provide roll up funcitonality inside WSS or MOSS.

Previously, roll ups were undertaken using Content Query Web Part, Third Party solutions like our friends at Bamboo or other custom components. For those who don't know what we mean by roll up, it is to take a central view on all content of certain type / property, e.g. all announcements from all webs in all site collections. The diagram below summarises...

Now I was going to type a long blog on how we did it using Search, but to save my fingers (or at least for the moment) take a look at DevCow

Of course, the beauty of the latest infrastructure update is that we now can roll up on the WSS platform.

Search is very powerful, not just for user defined results, but also for other tasks like that above. Hopefully, the next blog post will be a single persons profile, or displaying Business Data Catalog info

UPDATE - October

Something I forgot to mention when I posted the article was that using the normal Search Results web parts, there is a limit on how many items you can display at once without pagination

Currently rated 3.0 by 1 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

 

Dilbert of the day