Search This Blog

Top 15 SharePoint Conferences of 2013

PortalFront has published a list of the 15 best SharePoint conferences of 2013.

http://www.portalfronthosting.com/blog/top-15-sharepoint-conferences-you-should-be-attending-in-2013

I will be speaking at three of these events this year.  I am happy to be speaking at multiple SharePoint Saturdays, SPTechCon San Francisco and SharePoint Fest Denver.  I am looking forward to these - to learn new things, meet new people and talk about the technology I love.

If you're going to San Francisco, or Denver, you can use the links below to get a discount on your registration.

Use the code 'TUCKER' when registering for SPTechCon
Save $100 - SharePoint Fest

SharePoint Saturday Philadelphia

I was happy to learn today that I will be presenting a session at SharePoint Saturday Philadelphia (#SPSPhilly) on February 23rd.  The session is "Architecting a SharePoint 2013 Content Management Solution."  Keep an eye out HERE for registration information.  If you're in the area, I hope to meet you there.

Creating a Custom List Search Experience in SP 2010

So here's the business need.  In SharePoint 2010, I need to create a page which allows the user to search a specific list and see results on the same page.  However, the users do not generally interact with the list items directly, but see and touch them through a customized page which takes the list item id as a query string parameter.  So, the need is to create a custom search page to look at only one list and to customize the search results web part hyperlinks to point to custom pages rather than the list items.

  1. Create a search scope.  This is required to search a specific list.
  2. Create a search managed property for list item ID based on the crawled property ows_id.
  3. Run a content crawl to populate the new scope and pick up the list item ids.
  4. Create a new page in the pages library with a search box and search core results web part.
  5. Customize the two web parts to look in and point to the right spots.

Create the Search Scope

In Central Admin, go into your Search Service Application and click "Scopes" on the left.  Create a new scope, specifying title and keeping other defaults.  Create a Web Address / Folder rule with "Include" behavior.  In the "Folder" text box, specify the full URL path to your SharePoint list.  You should end up with someone like this:


Create a Search Managed Property

In the same Search Service Application, click "Metadata Properties" under the "Queries and Results" section on the left.  

The Item ID is already being picked up by the search crawler.  We are going to create a managed property to map to it which will be usable by the search web parts.  Click "New Managed Property".  After entering a name (I'm using ItemId) and a data type (Integer in this case), add a mapping to the crawled property "ows_ItemId."  

Also, make sure to go into the crawled property and check the box to include values in the index.

Crawl your Content

Click "Content Sources" on the left.  Choose the correct content source and run a full crawl.

Create the Page

Create a new page in your site that allows web parts and add the "Search Box" and "Search Core Results" web parts.  

Customize the Search Box

The search box web part needs to be customized to search our specific scope.  

We do this by changing a couple of properties.  First, we select to not show the scopes drop down.  Since the purpose of this page is to only search one list, no need to bother the user with having to select that every time.  We sneak our scope into the picture with the property "Additional Query Terms."  The syntax here is scope:scopeName.  

It was important for me to include the double quotes around the scope name due to the spaces.  Also important is to go under the Miscellaneous section and set the "Target search results page URL" property to the URL of the custom page.  Without this, executing the search would take you to the default search results page!








Customize the Search Core Results Web Part

Finally, we need to change some properties on the search core results web part.  If we just wanted to click on the list item and be taken to the item display page, we could stop here.  However, there are two more things we need to accomplish here.  One is to change the visible and clickable URL to point to a custom page which will show data from the list item, but with our visual customizations.  Since the way we are going to make this work is to pass the item id along to that custom page, we also have to plug the new managed property in to the columns and parameters the results web part knows about.

Let's start under "Display Properties," and uncheck the "Use Location Visualization" box.  This will allow us to edit the "Fetched Properties" text box.  It is here that we will add an entry for the search managed property we created earlier.  If we had not created that property, the results web part would not know what to do with item id, even though it is automatically crawled.  Somewhere in this XML fragment, just do a copy and paste of one of the <Column ... entries.  Change the name to whatever you called the search managed property.  In our case, this is "ItemId."
Next, we have to edit some XSL.  Brace yourself.  Click the XSL Editor button.  This will bring up a bunch of text that is probably easiest to work with by copying and pasting into Notepad or Visual Studio or some kind of text editor.  First thing we will change is the addition of a parameter.  Toward the top of the text, add a new xsl:param element.  Just copy and paste on that's there and change the name to ItemId.  We'll then take that and use it in the style templates below to change the URL.


In the XSL, you will need to find a span and an anchor tag.  Search for the following elements and replace the inner contents.  The finished product is shown below.  Obviously you will need to replace "accounts.aspx" with whatever custom page you have.  It is crucial that you refer to the parameter in the XSL below without a $ sign and in all lower case.  It's going to fail otherwise.


Search for '<span class="srch-URL2"' and replace it and its contents with the text below:

<span class="srch-URL2" id="{concat($currentId,'_Url')}">  
<xsl:value-of select="concat('account.aspx?ID=', itemid)" />
</span>

This displays the URL in the bottom of the search result item, the viewable URL.

Search for '<a id="{concat($currentId,'_Title')}">' and replace it with this text:

<a id="{concat($currentId,'_Title')}">
<xsl:attribute name="href"><xsl:value-of select="concat('account.aspx?ID=', itemid)" />
</xsl:attribute>

This is the clickable link, the redirection to the item (or in this case, the custom page)


Finish Up

Save the changes to your web part and stop editing the page.  You should now be able to successfully test this with data from your list.  I hope this saves you some time and trouble if you need to create a custom search page for a given SharePoint list or need to change the search results in a custom page or on your main search page.  Let me know your thoughts and questions...




10 more days to save $600 on SPTechCon San Francisco

The early bird discount of $400 applies now through January 18th.  In addition, since I am speaking this year, I can offer an extra $200 off to you if you use my last name (TUCKER) as a discount code when purchasing your registration here: http://www.sptechcon.com/SanFrancisco2013/

I hope to see you there!

SharePoint Saturday Virginia Beach Slides

Just wanted to say thank you to everyone who attended my session at the SPS in Virginia Beach today.  You can find a copy of the session slides here: http://www.slideshare.net/patrick_tucker/sps-virginia-beach-ssrs-2012-and-sharepoint-2010-reporting

It was a great event and I was very pleased to be a part of the 5 year anniversary of the first SharePoint Saturday.