Archives For How To


The SharePoint 2013 My Site has a neat new feature of aggregating all of your tasks and allowing you to complete a task with a single click, no matter where the task resides. This eliminates the need for the assignee to go to all of his/her team sites and update their tasks. However, in certain scenarios, the my site and OneDrive experience has not been fully adopted. So, I decided to write a display template that could utilize CBS (Content By Search) web part to rollup all tasks. The display template also allows you to mark the task completed, launch in a modal, and asynchronously update. Let’s get started.

Summary

Here is what the web part will look like when we finish.

image

Continue Reading…


Consider this scenario: You create a new web and add several apps. Next, you make some master page modifications and choose the “Reset All Subsites” option when applying the master page. This prompts SharePoint to reset all MasterUrl and CustomMasterUrl properties to point to the root web. Because all of our apps are running in their own App-Web (Aka sub-site) these sites are reset too. So now when are apps are rendered the master page it calling to the root web for its masterpage. This results in error because the app is not allowed to call outside of its own web. (Some scenarios allow cross-site calls).

 

To fix this we need to rewrite the app master page URL. We can do this for all apps using PowerShell.


$appWebs = (Get-SPSite -Identity <YourSiteCollectionURL> -Limit All).AllWebs | ?{$_.Url -match "<YourAppURL>"} #Your app URL should be company-app.com, etc
foreach ($app in $appWebs) {
$masterUrl = $app.ServerRelativeUrl + "/_catalogs/masterpage/Seattle.master"
$app.MasterUrl = $masterUrl
$app.Update()
}

We can now access the configuration pages within our apps.

 

{Kam}


A new SharePoint site can be a nice shiny new toy to some and ‘just another tool’ to others. Our information architecture and taxonomy determine how easy it ‘should’ be for users to find information. After all, there is a cost associated with a lack of discoverability and usability of a given SharePoint site. It is important that we are always enforcing governance to ensure the site is being used properly and we also need to be able to measure the successes and shortcomings of our sites.

 

We have a couple of tools out of the box that we can use to see how the site is being used.

Continue Reading…


When you use the promoted links app in SharePoint 2013 you will notice that the default behavior is to run the tiles off the right of the screen and show paging buttons(below) image

This is because the CSS class ms-promlink-body is set to a width of 10000px. Not sure why they did this but there is a quick fix for it.

Option #1 – Recommended

Add the following override to your style sheet.

.ms-promlink-body {
max-width:100%;
}

.ms-promlink-headerNav{
display: none;
}

Note: This will affect all promoted links apps.

Option #2 – Script Editor

  1. Go to your Tiles.aspx view for your promoted links list.
  2. Select the Gear –> Edit Page
  3. Add a script editor web part to the page.
  4. Add the code snippet below to fix the width.

<style type=”text/css”>

.ms-promlink-body {
max-width:100%;
}
.ms-promlink-headerNav {
display: none;
}
</style>

Note: This will only affect the current promoted links app.

Important: Because we are adding a web part to a default list view page SharePoint treats this as a modified application page. Due to this, when we view the page the Item/List tabs are missing. To get them to show we must click inside the List(Tile) view web part to activate the button in the ribbon. This can be done by clicking on some white-space within the actual web part.

Result:

image

 

{Kam}


Need to cycle IIS on all of your SharePoint servers? There are a couple ways to do it in 1-2 lines of PowerShell.

Option 1 (Requires SharePoint Admin shell or the Microsoft.SharePoint.PowerShell add in to be loaded)

Get-SPServer | ?{$_.Role -ne "Invalid"} | %{iisreset $_.Address}

Option 2 (Can be run from any POSH shell)

$servers = @("sp1","sp2","sp3")
$servers | %{iisreset $_}

Option 2 requires that you put your servers into an array manually. This could also be run on a single line.

$servers = @("sp1","sp2","sp3"); $servers | %{iisreset $_}

Happy POSHing!


A new feature of 2013 are the metro-style tiles. Every new team site has them as a banner on the homepage.

image

To create your own tiles you are limited to the promoted links app or the Announcement Tiles feature. I wanted the ability to use the tiles in my search results and other areas as needed. I have two display templates that will allow you to do just that, with any type of content within SharePoint. The solution consists of 3 parts:

  • Display Template
  • JavaScript file (Used for moving panel on mouse-over events)
  • CSS file for rendering the tile correctly.

 

Let’s get started…..

First we need to get our code and place them in their respective areas. Attached you will find the 3 files needed for this display template:

    • Item_HorizontalTiles.html
    • Item_VeritcalTiles.html
    • Tiles.css
    • Tiles.js

The item templates (Veritcal/Horizontal) need to be placed in your site collection display templates folder. The path is _Catalogs/masterpage/Display Templates/Content Web Parts/. The easiest way to do this, if you are not familiar with display templates is using the Designer manager via the site gear. When you drop these files SharePoint will automatically create a linked <name>.js file. This file contains all the JavaScript that is outlined in the display template.

Next, we need to place our CSS and JS files. I have placed mine in the /Style Library/CSS and /Style Library/JS respectively. You don’t have to place the files in this location. However, if you choose to put them somewhere else you will need to update the $includeScript and $includeCSS path in the display template HTML file.

 

Information about the template

The template renders a tile similar to one you use with promoted links and announcements tiles. It allows to you to map the following fields:

    • LinkURL (Auto Do Not Change)
    • PictureURL (Automatically pulls the most common managed properties for images)
    • Title (Title of the tile – First Line)
    • Description (Description of the tile – Second line onmouseover)

These fields can be mapped using the Content By Search web part when the display template is selected (See below)

image

As you can see I am setting this first search to return people:

image image

 

We could also change our query to return documents:

image        image

 

We could show announcements:

image image

Note: If you just added the ‘Rollup Image’ column to your announcements, the tile would show your image on the tile as well.

 

We can show article pages:

image image

You also choose to arrange these vertically using the Item_VerticalTile display template called “Vertical Tile” in the web part property selector.

image

 

As you can see, with the tile we can view any type of content we want. The HTML display template is easy enough to tailor this to any specific need or specific content that you would like. It is not necessarily a one-size-fits-all but it is a good start.

Source Files: https://github.com/kameronberget/SharePointPhiles

{Kam}


datatable

This might be one of the coolest JavaScript libraries out there for SharePoint, DataTables.js. DataTables.js allows you render a set of search results in data table format allowing you to Sort, Filter and Page automatically. Because SharePoint search allows you to search and return items from the entire farm you lost the ability to dynamically sort and quickly filter. DataTables give you this back in a very quick and easy to use format. To get data tables working we need the following:

  • jQuery library reference
  • DataTables library reference
  • DataTables base or custom css style sheet
  • Custom Control Template
  • Custom Item Template

Let’ s get started. First we need to created out custom control and item templates. These templates are created and stored at the site collection level. They are saved in the Master Page Gallery > Display Templates > Content Web Parts To create these two files you need to create two HTML files. This can be done by either copying an existing item and control template and replacing the code with the code below OR you can copy and paste this code directly into a new HTML file(s). Control Template Copy and paste the following code into a new Control_Grid.html file

Continue Reading…


There has been a lot of buzz and questions around connecting your Office 365 tenant to data located on Premises. This is a common requirement and is now made possible with PowerBI.

Connecting to your data source is made possible with the Data Management Gateway(DMG) The awesome part of the DMG is that is makes the connection outside the firewall. That means, no reverse proxies, custom web services or firewalls to deal with!

Overall, there are few requirements and caveats that I encountered while setting up my demo environment. FYI, I set this up in under and hour, including the time is took to spin up a PowerBI trial.

  • The DMG must be installed on a non-SQL server in your on premises environment. I could not get anything to work on my SQL server so I am thinking this has to be done on a member server,
  • A new Gateway must be created via your bi admin center.
  • You must register the gateway with the on premises DMG client.
  • You can then store your credentials for the data sources on premises OR in the cloud. The benefit to storing the creds in the cloud is you can recover quicker from a system failure.
  • Let’s get started

Continue Reading…