Advanced Promoted Links

SharePoint 2013 includes a special type of link app called “Promoted Links”, where Metro style icon tiles can be added to a web page, each with a background image. Microsoft use Promoted Links for the “Getting Started” panel commonly seen on the welcome page of a newly created site. Although Promoted Links add a modern and stylish look to a web page, they are not that versatile. This blog post explains how you can install and configure a free alternative to Promoted Links where you can adjust the size, colour and position of individual icon tiles.

  1. First visit the spjs blog site to download the necessary files to get started: http://spjsblog.com/2013/11/13/sharepoint-2013-style-tiles/
  2. Download two files shown:


3. Next download JQuery files shown:
   
Download the compressed, production jQuery 1.11.3 or
Download the compressed, production jQuery 2.1.4 (will not work with IE6, 7, or 8)

4. Add a “Script Editor” Web Part to the SharePoint page. Use the “INSERT SNIPPET” option to add the following code:

<div id=”spjs_tiles_placeholder” style=”margin:10px;float:left;clear:both;”></div>

<link href=”https://portal.contoso.com/sites/HR/SiteAssets/font-awesome-4.4.0/css/font-awesome.css” rel=”stylesheet”>

<link type=”text/css” href=”/sites/HR/SiteAssets/SPJS-Tiles.css” rel=”stylesheet”>

<script type=”text/javascript” src=”/sites/HR/SiteAssets/jquery-2.1.4.min.js”></script>

<script type=”text/javascript” src=”/sites/HR/SiteAssets/SPJS-Tiles_min.js”></script>

<script type=”text/javascript”>

spjs.tiles.init(“spjs_tiles_placeholder”,”MyTiles“);

</script>

You must change the css file href and the script src to point to your local files (SiteAssets).

When you save this code, and reload the page, you should see this banner:


5.  Click to create the SPJS-Tiles configuration list. It will be placed in the same site as you triggered this script. You should be redirected to the list after it has been created. If this fails, you can find the list in “All site content” as “SPJSTiles”.

6.  SPJS Tiles v1.2.2 and above includes support for “FontAwesome”. The above script (step 4) includes reference to local copies of the downloaded FontAwesome files. To download the files go to: http://fontawesome.io/icons/ More details are also provided on the spjs blog site – see http://spjsblog.com/2013/11/19/sharepoint-2013-style-tiles-change-the-size-and-color-of-the-tiles/

The downloaded files need to be added to the site’s “Site Assets” library also:


7.  Ensure the script (step 4) correctly references the URL location of the font-awesome.css added to the “Site Assets” library.

8. My sample SPJS-Tiles configuration list looks like:


Ensure that the Title contains the value added to the script (Text 4 highlighted) e.g. “MyTiles”. The Text appears inside the promoted link tile and includes MUI support, e.g. {“1033″:”English value”,”default”:”default value”}. You can add all the languages you have installed language packs for. Use “default” as a fallback if the language the user has selected has not yet been configured for the tile.

The Description appears when the mouse hovers over a promoted link tile. The Image column references a URL of an image if you optionally wish to display a background image in the promoted link tile. The FontAwesomeIcon column can optionally contain one of the available fonts from the http://fontawesome.io. web site. For example, for a Word Document image, the “file-word-o” class becomes “fa-file-word-o” text in this column. The FontAwesomeStyle determines how the icon appears. It follows the standard format of the HTML in-line Style tag. E.g. color:#ffffff;font-size:70px;padding-left:38px;padding-top:15px;

The BgColor can contain colour names to change the background colour of the promoted link tile. The TileSize determines how large the tile appears on the page. The URL defines where the promoted link tile links to.

The RefreshParent column is set to “Yes” for icon tiles. The Index column determines the order the tiles appear. On my example, the “00-00” defines a heading, “00-01” through to “00-03” defines three tiles on the first row, and “01-01” defines a tile on a second row.


9.  You can create custom promoted links based on how you configure the SPJS-Tiles configuration list. Here’s a couple of examples:

Without headings and with variable tile sizes:


 

With headings and with variable tile sizes:


Here is the SPJS-Tiles configuration list example for the above:



Adding Custom Refiners to SharePoint Search

Background
On this example, I have created multiple document type columns
– each document type column is uniquely paired to a content type. So for example, a “Meeting Document” content type includes a “Meeting Document Type” column, and a “Correspondence” content type includes a “Correspondence Document Type” etc.

RefinableString managed properties
To add a custom
refiner you must first map one or multiple crawled properties to one of the built-in Refiner managed properties. For this example, in Central Admin > Search Administration > Search Schema, I chose to use the “RefinanbleString01” managed property and map it to all the different document type crawled properties. You must select the crawled property starting with “ows_” for this to work. For example, the crawled property for Meeting Document Type is called “ows_MeetingDocumentType”. Once all mapped crawled properties are added, give the “RefinanbleString01” an Alias name so you can recognise it when configuring the Refinement Web Part.

Next run a full crawl.

When the crawl has completed, access the Search Results page where you wish to re-configure the Refinement Panel. Edit the Refinement Panel Web Part and click on the “Choose Refiners” button:

Add the e.g. “RefinableString01” managed property. In the properties displayed below give the refiner a Display Name – in my case “Document Type”. Click “OK” to save the Web Part’s settings and save/publish the search results page. Now try some searches and confirm the Refiner behaves correctly.

Testing how new document versions are handled when sent to a SharePoint 2013 Records Center

Introduction
There are a number of EDRM configuration options in SharePoint 2013 including ‘In-Place’ Records Management (IP-RM) and submitting documents to Records Centers (copying, moving, or moving and leaving a link). Detailed below is how a Records Center can be used to capture each document version as a record, whilst allowing the original document to continue to be updated.

Test 1: Submitting a copy of each major version of a document to a Records Center records library
1)  Upload ‘Caboodle TC’ document to a document library configured with a ‘Project Document’ content type and Major Versioning.

2)  Send a copy of ‘Caboodle TC’ to the Records Center.

3)  Check the Records Center Content Organizer rule correctly added the item to the ‘ProjectDocs’ records library.

4)  Update the original ‘Caboodle TC’ document to create a Version 2.0. Re-send a copy to the Records Center and check the Records Center ‘ProjectDocs’ records library.

The result is SharePoint adds the new major version to the same ‘ProjectDocs’ records library, but appends a unique code to the name of the copied item. The Records Center therefore stores a record per submitted version.

Test 2: Submitting a copy of each major version of a document to a Records Center records library
1)  Upload ‘ExcelDocument’ document to a document library configured with a ‘Project Document’ content type and Major Versioning.

2)  Send a copy of ‘ExcelDocument’ to the Records Center.

3)  Check the Records Center Content Organizer rule correctly added the item to the ‘ProjectDocsLibrary’ document library.

4)  Update the original ‘ExcelDocument’ document to create a Version 2.0. Re-send a copy to the Records Center and check the Records Center ‘ProjectDocsLibrary’ document library.

The same behaviour is exhibited, i.e. SharePoint creates a new item with an appended unique code in the ‘ProjectDocsLibrary’ within the Records Center. The Records Center therefore stores a record per submitted version.

So in conclusion, it is not possible to ‘overlay’ a superseded document version in the Records Center – separate items are always created. The only way around this would be using code/custom workflows. If In-Place RM was used to declare a published and approved item as a record, there would have to be a custom workflow process that un-declares the record to allow edited updates. The workflow would then manage the re-declaration of the In-Place record after it is re-published.

If records need to be declared, the workflow and custom development approach has to be recommended. I am personally in favour of using the Major & Minor Versioning and Content Approval capabilities of a standard document library without RM. You can still apply retention schedules and audit track events. The security trimming ensures that only relevant users can update the document and view draft copies. Only published/approved documents can be visible to the majority users by browsing or through search. Using the Search Results Web Part we can ensure that users always see the latest published version, whilst document owners can continue to work on draft versions.

If RM is not used in SharePoint you lose the ability to place holds on records and you lose the extra assurance that a document cannot be edited. However, the holds could be achieved programmatically with documents. The assurances can be derived from good security and auditing. I would therefore suggest that Records Centers are only used for the longer-term archiving of important or vital records, such as information on asbestos that needs to be kept for 50 years, or financial documents that need to be kept for 6 years etc. In-place records should only be used when documents no longer need to be updated, but the original context of the storage location needs to be retained.

How to create a Three Lines Search Display Template

Before starting ensure the SharePoint Server Publishing Infrastructure site collection feature is activated:

1.  Access SharePoint Designer 2013. Open the site to add a new search display template.

2.  Click on “All Files” and “_catalogs” and “masterpage” and “Display Templates” and “Content Web Parts”:

SharePoint Designer 2013 Display Templates

3.  Select the display template to base the new display template on. In this example I have created a new display template based on the “Item_TwoLines.html” file. Right-click and select “Copy”. Right-click and select “Paste”. (Note: The JavaScript pair file is created automatically).

4.  Select the copied item and rename it e.g. “Item_ThreeLines.html”. Wait for the JavaScript to correctly copy (use the Refresh function). Ensuring the new renamed html item is selected, right-click and select “Check Out”.

5.  With the item selected right-click and select “Edit File in Advanced Mode”. The Advanced Editor displays the HTML.

The updated “Item_ThreeLines.html” appears as below. The highlighted elements indicate what has been added to the Item_TwoLines.html code:

<html xmlns:mso=”urn:schemas-microsoft-com:office:office” xmlns:msdt=”uuid:C2F41010-65B3-11d1-A29F-00AA00C14882″>
<head>
<title>Three lines</title>
<!–[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:TemplateHidden msdt:dt=”string”>0</mso:TemplateHidden>
<mso:ManagedPropertyMapping msdt:dt=”string”>&#39;Link URL&#39;{Link URL}:&#39;Path&#39;,&#39;Line 1&#39;{Line 1}:&#39;Title&#39;,&#39;Line 2&#39;{Line 2}:&#39;Title&#39;,&#39;Line 3&#39;{Line 3}:&#39;&#39;,&#39;FileExtension&#39;,&#39;SecondaryFileExtension&#39;</mso:ManagedPropertyMapping>
<mso:MasterPageDescription msdt:dt=”string”>This Item Display Template will show a small thumbnail icon next to a hyperlink of the item title, with an additional line that is available for a custom managed property.</mso:MasterPageDescription>
<mso:ContentTypeId msdt:dt=”string”>0x0101002039C03B61C64EC4A04F5361F385106603</mso:ContentTypeId>
<mso:TargetControlType msdt:dt=”string”>;#Content Web Parts;#</mso:TargetControlType>
<mso:HtmlDesignAssociated msdt:dt=”string”>1</mso:HtmlDesignAssociated>
<mso:HtmlDesignStatusAndPreview msdt:dt=”string”>http://hsweb01/sites/navigate/_catalogs/masterpage/Display Templates/Content Web Parts/Item_ThreeLines.html, Conversion successful.</mso:HtmlDesignStatusAndPreview>
<mso:HtmlDesignConversionSucceeded msdt:dt=”string”>True</mso:HtmlDesignConversionSucceeded>
</mso:CustomDocumentProperties>
</xml><![endif]–>
</head>
<body>
<!–
Warning: Do not try to add HTML to this section. Only the contents of the first <div>
inside the <body> tag will be used while executing Display Template code. Any HTML that
you add to this section will NOT become part of your Display Template.
–>
<script> $includeLanguageScript(this.url, “~sitecollection/_catalogs/masterpage/Display Templates/Language Files/{Locale}/CustomStrings.js”);
</script>
<!–
Use the div below to author your Display Template. Here are some things to keep in mind:
* Surround any JavaScript logic as shown below using a “pound underscore” (#_ … _#) token
inside a comment.
* Use the values assigned to your variables using an “underscore pound equals”
(_#= … =#_) token.
–>
<div id=”ThreeLines“>
<!–#_
var encodedId = $htmlEncode(ctx.ClientControl.get_nextUniqueId() + “_3lines_”);
var linkURL = $getItemValue(ctx, “Link URL”);
linkURL.overrideValueRenderer($urlHtmlEncode);
var iconURL = Srch.ContentBySearch.getIconSourceFromItem(ctx.CurrentItem);
var line1 = $getItemValue(ctx, “Line 1”);
var line2 = $getItemValue(ctx, “Line 2”);
var line3 = $getItemValue(ctx, “Line 3”);
line1.overrideValueRenderer($contentLineText);
line2.overrideValueRenderer($contentLineText);
line3.overrideValueRenderer($contentLineText);
var containerId = encodedId + “container”;
var pictureLinkId = encodedId + “pictureLink”;
var pictureId = encodedId + “picture”;
var dataContainerId = encodedId + “dataContainer”;
var line1LinkId = encodedId + “line1Link”;
var line1Id = encodedId + “line1”;
var line2Id = encodedId + “line2”;
var line3Id = encodedId + “line3”;
_#–>
<div class=”cbs-Item” id=”_#= containerId =#_” data-displaytemplate=”Item2Lines”>
<a class=”cbs-ItemLink” title=”_#= $htmlEncode(line1.defaultValueRenderer(line1)) =#_” id=”_#= pictureLinkId =#_”>
<img class=”cbs-Thumbnail” src=”_#= $urlHtmlEncode(iconURL) =#_” alt=”_#= $htmlEncode(line1.defaultValueRenderer(line1)) =#_” id=”_#= pictureId =#_” />
</a>
<div class=”cbs-Detail” id=”_#= dataContainerId =#_”>
<a class=”cbs-Line1Link ms-noWrap ms-displayBlock” href=”_#= linkURL =#_” title=”_#= $htmlEncode(line1.defaultValueRenderer(line1)) =#_” id=”_#= line1LinkId =#_”>_#= line1 =#_</a>
<!–#_
if(!line2.isEmpty)
{
_#–>
<div class=”cbs-Line2 ms-noWrap” title=”_#= $htmlEncode(line2.defaultValueRenderer(line2)) =#_” id=”_#= line2Id =#_”>_#= line2 =#_</div>
<!–#_
}
_#–>
<!–#_
if(!line3.isEmpty)
{
_#–>
<div class=”cbs-Line2 ms-noWrap” title=”_#= $htmlEncode(line2.defaultValueRenderer(line3)) =#_” id=”_#= line3Id =#_”>_#= line3 =#_</div>
<!–#_
}
_#–>
</div>
</div>
</div>
</body>
</html>

6.  Save the edited “Item_ThreeLines.html” file. Check In the file and publish as a Major Version.

7.  If updated correctly, the new Display Template will appear in the “Content Search” Web Part properties. Select the display template name e.g. “Three lines”, as shown below:

Content Search Web Part Display Template Properties

8.  Expand the “Property Mappings” and tick the “Change the mapping of managed properties…” tick box. Note that a Link URL and Line 1, Line 2, and Line 3 appear based on the HTML changes. Click the drop-down menus to select available managed properties. On my example I have chosen to display a custom managed property called “DEVBMSID”, Title and UIVersionStringOWSTEXT (Version Number).

9.  To ensure that the Content Search Web Part only displays relevant documents click on the “Change Query” button in the “Search Criteria” section. Use the Quick Mode query builder or switch to Advanced Mode and enter search syntax – see example below:

Content Search – Build Your Query

10. You can test the results before clicking the “OK” button to save the search. Note: Refiners and Sorting can also be defined.

11. Ensure the “Number of items to show” is set to a suitable number – otherwise not all search results will be displayed.

12. Finally click on the Content Search Web Part properties “OK” button to save all settings.

 

Hiding the first global navigation heading in SharePoint 2013

Slightly different CSS has to be added to hide the first global navigation heading in SharePoint 2013.

/*

hide the top nav home link

N.B. this will hide all managed metadata navigation will probably require javascript as well

*/

.ms-core-listMenu-horizontalBox > .ms-core-listMenu-root > li > a {

                display:none;

}

 

This will prevent the site collection name appearing as the first global heading link.

Note: This will not work if you are using Term-driven Navigation.

SharePoint 2013 Search Results Not Displaying All Results

I have been playing with the “Search Results” Web Part that appears in SharePoint 2013. I was attempting to search for three different content types and display the results. The new Query Builder allowed me to quickly build the query:

ContentType:”Memo” ContentType:”Policy” ContentType:”Procedures”

The “Test Query” button correctly displays 4 results. However, when the Web Part is saved only 2 results are displayed. Why could this be?

After a bit of routing around I found this blog post that resolved the problem : http://blogs.perficient.com/microsoft/2013/04/sharepoint-2013-search-not-display-all-results/

SharePoint Search attempts to trim the results when it sees similar content. I was using sample documents with almost identical content, so 2 of the results were not being displayed!

To overcome this you need to:

1. Export the Search Results Web Part from your page.

2. Open the .Web Part file in your e.g. Notepad++.

3. Search for “TrimDuplicates” – mine was on line 42.

4. Change the TrimDuplicates property from True to False.

5. Upload the updated Web Part.

6. Add the Web Part to your page.

It should now work.

Create a SharePoint content database in SQL Server

There are several ways of creating a SharePoint content database. First you can create a content database via the SharePoint Central Administration console. However this approach disregards any settings the DBA may wish to employ based on the SQL Server model database. Even if the “Model” system database is configured in SQL Server, the content database will not pick up the autogrowth settings. So the preferred approach for IT Pros is for the DBA to first create the content databases in SQL Server itself. The System Administrator can then create web apps and site collections that reference these databases. Taking this approach, what options are available?

1)      Use PowerShell scripts to create the content databases.

2)      Create the databases in SQL Server directly.

For Option 2, I recommend you watch the following video that explains step-by-step how to do this – see “Tuning SQL Server 2012 for SharePoint 2013 – Best Practices for SQL Server Database Settings” at http://channel9.msdn.com/Series/Tuning-SQL-Server-2012-for-SharePoint-2013/Tuning-SQL-Server-2012-for-SharePoint-2013-02-Best-Practices-for-SQL-Server-Database-Settings#time=20m24s

Things to bear in mind:

1)      Set the Model system database with your default Initial database and log Initial Size and Autogrowth configuration settings:

2)      Ensure the Model system database “Options” Recovery model is set to “Full” on the Production Server:

3)      Set the correct Collation, so that SharePoint web apps and site collection can pair up with the content databases.

4)      Now the SharePoint System Administrator can start creating site collections in Central Admin or PowerShell and pair with the newly created content databases.

Note: Ensure that if content databases are taken “Offline” (to avoid site collection pairing) that they are brought back to “Ready” when done; otherwise search crawls etc. will exclude the content databases. You can also set the maximum number of site collections on a content database to ensure that a new site collection does not pair with the content database.

The PowerShell approach is explained further in the following references:

Reference Link
SQL Server PowerShell Provider http://msdn.microsoft.com/en-us/library/cc281947.aspx
Add content databases in SharePoint 2013 http://technet.microsoft.com/en-us/library/cc825314.aspx
SQL Server Community (Toad World) http://www.toadworld.com/platforms/sql-server/default.aspx