Friday 25 July 2014

SharePoint 2013 OOTB lookup list filtering

Problem
I don't want to start customising my solution and I need a lookup column with restricted options.  I read this post from April Dunnam via Google and it's awesome and I wish I had thought of it first.

I have 2 lists: Countries (Country, Continent) & Business (Name, LocationInAsia, LocationInEurope).  I want to be able to specify their head office in each continent.  I could do a lookup list to country and show all the countries or I can use Aprils approach and only show Countries for the specific region.  This is a contrived example but it's a simple way to explain it.

Resolution:
On the Countries list create a Calculated column/field, call it "AsianCountries". 
The formula is =IF([Continent]="Asia",Country,"")
On the Business list, create a lookup called "LocationInAsia" that points to the "AsianCountries" field in the Countries list.

http://www.sharepointsiren.com/2013/05/sharepoint-2007-2010-2013-filtered.html

Summary:
This is pretty useful in that I don't need to write and custom code to have lookup lists that only show the appropriate content.  Sure I need to have extra calculate columns but a good no code way to restrict lists lookups.


 

Saturday 12 July 2014

SharePoint 2013 Search Series - Post 3 - Search Box Web Part to only query Managed Properties

Search Series:
SharePoint 2013 Search Series - Post 1 - Configure Custom Search
SharePoint 2013 Search Series - Post 2 - Refiners
SharePoint 2013 Search Series - Post 3 - Search Box Web Part query Managed Properties(This Post)
SharePoint 2013 Search Series - Post 4 - Search Result Source Removal
SharePoint 2013 Search Series - Post 5 - Restricting Results & Enable pdf previews

Overview:  In this post we are looking at using a Display Template to change how the Search input box works.  Specifically the example will look at making the search box only search on the Title property of documents.  It will search for any part of the title.  If my word document is called "Std-634-HealthandSafety", using the search term "634" we get the document.

Steps to Change the way the Search Box works:
1.> Copy the Display Template "Control_Display Template", edit & rename the new template and upload to the Display Template gallery.
2.> Change the Title element tag in the Display Template and amend the html as shown below to change the behaviour of the search box.
3.> When the html display template is uploaded, you will notice the js file with the same name is updated.  Remember to Publish the html display template.
4.> On the Search Page edit or add the Search Box Web Part.  Select the Display Template, in my case it is "Demo Title Search Box" and save.
Search now only does a wild card search on the Title of the uploaded documents (assume the content has been crawled).

Search Series:
SharePoint 2013 Search Series - Post 1 - Configure Custom Search
SharePoint 2013 Search Series - Post 2 - Refiners
SharePoint 2013 Search Series - Post 3 - Search Box Web Part query Managed Properties(This Post)
SharePoint 2013 Search Series - Post 4 - Search Result Source Removal
SharePoint 2013 Search Series - Post 5 - Restricting Results & Enable pdf previews

Sunday 6 July 2014

SharePoint 2013 Search Series - Post 2 - Refiners

Search Series:SharePoint 2013 Search Series - Post 1 - Configure Custom Search
SharePoint 2013 Search Series - Post 2 - Refiners (This Post)
SharePoint 2013 Search Series - Post 3 - Search Box Web Part query Managed Properties
SharePoint 2013 Search Series - Post 4 - Search Result Source Removal
SharePoint 2013 Search Series - Post 5 - Restricting Results & Enable pdf previews

Overview:  Refiners are a powerful way of drilling into your search result data.  This post aims to look at configuring the search refiner web part.  Any Managed Property can be marked as a refiner and then used on the Refinement Web Part.

Steps to setup a refinement panel:
1.> Add the "Refinement" search web part to your search page.
2.> Edit the Web part and under the "Choose Refiners" button select the appropriate Refiners.

3.> Add custom managed properties as shown below, mark the managed property as "refineable" and it will show up in the "available Refiners" screen.

4.> Add your custom "Available Refiners"
5.> Save and publish the web part and check the refiners are working.

Search Series:
SharePoint 2013 Search Series - Post 1 - Configure Custom Search
SharePoint 2013 Search Series - Post 2 - Refiners (This Post)
SharePoint 2013 Search Series - Post 3 - Search Box Web Part query Managed Properties
SharePoint 2013 Search Series - Post 4 - Search Result Source Removal
SharePoint 2013 Search Series - Post 5 - Restricting Results & Enable pdf previews

Saturday 5 July 2014

SharePoint 2013 Search Series - Post 1 - Configure Custom Search


Overview: This series of posts examines SharePoint 2013 search.  It looks at configuration to get Search working for you.  There are other posts on this blog about configuring your Search architecture and farm.

This post looks at 2 main points: 1.> crawling content and 2.>  Result Sources.

Search Series:
SharePoint 2013 Search Series - Post 1 - Configure Custom Search (This Post)
SharePoint 2013 Search Series - Post 2 - Refiners
SharePoint 2013 Search Series - Post 3 - Search Box Web Part to only query Managed Properties
SharePoint 2013 Search Series - Post 4 - Search Result Source Removal
SharePoint 2013 Search Series - Post 5 - Restricting Results & Enable pdf previews

1.> Crawling Content:  The UI in CA has changed but if you understood crawling in previous versions of SharePoint, it still works the same way.  You are looking to create indexes by crawling content.  The image below shows the Search Administration screen after choosing the "Content Sources" option.  This will allow you to create content sources and configure them so SharePoint can get data into the indexes and have permission awareness (ACL).

After setting up your Content Sources run a full crawl to populate the indexes.

The "Crawl Log" is extremely useful to see when crawls where run and what content has been included. 

Once all the content is crawled you are ready to look at the Results Source formally referred to as Search Scopes.

Tip: The crawler must run through all content to be searchable, I still see clients trying to restrict data by no crawling it.  Crawl everything and restrict on the query side what comes out. 
Tip: Don't create to many Content Sources.  This can be a tough item to figure out, my advice is use as few Content Sources as possible and break them up by how often the content needs to be crawled.

2.> Result Sources: You can create Result Sources at the SSA/farm level down to the web/SPSite level.  This example is looking to return data from a specific path for a particular content type, so I created the Result Source at the site level.

Tip: The "Search Result Preview" is really useful for checking you are doing this correctly.

Once I have a "Result Source" setup I go to my search page and add a "Search Results" web part to output the results to my user.  I  can edit the "Search criteria" on the web part to use my new "Result Source".  The picture below is annotated to explain setting up the Search Results Web Part.


Search Series:
SharePoint 2013 Search Series - Post 1 - Configure Custom Search (This Post)
SharePoint 2013 Search Series - Post 2 - Refiners
SharePoint 2013 Search Series - Post 3 - Search Box Web Part to only query Managed Properties
SharePoint 2013 Search Series - Post 4 - Search Result Source Removal
SharePoint 2013 Search Series - Post 5 - Restricting Results & Enable pdf previews

Thursday 12 June 2014

Migration test of Sharegate to SP2013

Problem: I am looking at migrating some basic content into an SP2013 farm from SP2010.  I would normally opt for Metalogix or DocPoint if the client already has the licences but today I needed to use another tool namely Sharegate.  I used Sharegate.Migration.4.6.3

Scenarios:
SP2010 blog posts to an existing SP2013 blog.
SP2010 lists into SP2013.

Screenshot of the tool:


Verdict:  A great tool, easy to use, mapped over data cleanly.  Absolute winner! 

Updated: 2018/10/23
I also like Metalogix but Sharegate is still a brilliant tool for SharePoint data migration.

Wednesday 11 June 2014

CAML Designer for SharePoint 2013 is Brilliant

I always used U2U for checking my CAML queries in SharePoint.  I have just used CAML Designer for SharePoint 2013 and it is brilliant.

Link to the CAML Designer tool
http://karinebosch.wordpress.com/2012/12/13/caml-designer-for-sharepoint-2013-released/

Simple Example of using CAML to query a list:
string riskListCAMLQry  = "<Query><Where><Eq><FieldRef Name='Status' /><Value Type='Text'>Scheduled</Value></Eq></Where><View><RowLimit>1000</RowLimit></View></Query>"

Call using C# CSOM
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = riskListCAMLQry;  
// Add a where clause on the status on the list to restrict the result set, only return the first 1000 rows

Saturday 7 June 2014

Content database Sizing & Cleanup

Problem:  At a customer site, a content database is massive.  Various Site collections are using the same content database. 

Initial Hypothesis:  Smaller site collections can be moved to new separate content databases.  This reduces the size to some degree.  The SQL log (ldf) is in good shape.  The excessive size is due to 3 unavoidable issues, multiple versions of large blobs (we need the versioning so not an option).  The recycle bin is set to the default 50% and my dumping older content is brings down the size and lastly, delete content databases are still sored within SQL. 

Resolution: Remove the previously deleted site collections fro the content database.   Using CA, I tried to run the "Gradual Site Delete timer job", it no difference, the delete site was still lingering about. 

Used PowerShell to remove the deleted site collections as shown above.  E.g. PS> Remove-SPDeletedSite -Identity ""

More Info:
http://blogbaris.blogspot.co.uk/2013/01/delete-sharepoint-2010-site-collection.html