Data source details link disabled in SharePoint Designer 2013

I haven’t seen anyone else write about this yet, but now that I’ve run into this problem several times I decided it was time to post about it.

I’m talking about some strange behavior with the Data Source Details pane in SharePoint Designer 2013.

Here’s the scenario I ran through:

  1. I created a new wiki page in my Site Pages library and opened it in SPD 2013 for editing so I could add a custom data view.
  2. After using the usual “Parse Html” hack to get the Data View button to light up on the Insert tab, I chose to insert an Empty Data View onto my page.
  3. I then clicked inside my data view web part tag (because remember, we have no design view in SPD anymore) and inserted a data source using the Data Source button on the Insert tab.
  4. I next tried to edit my data source in the Data Source Details pane, but the link under the “Current Data Source” label (which in my case said “DataView 1…”) was disabled. Clicking around and saving/refreshing the page in SPD didn’t help.

After a few minutes, I discovered the workaround is to hide and re-show the Data Source Details pane using the Data Source Details button on the Options tab of the “Data View Tools” group in the ribbon (while my cursor was inside of the data view web part tag, which causes the “Data View Tools” group to be visible). Clicking that button twice to hide and re-show the pane fixed the problem, and I could now edit my data source.

I must say, I continue to be dismayed with how strangely SharePoint Designer 2013 behaves sometimes. It seems like at least 50% of the tasks I try to accomplish require at least one workaround to successfully complete the task.

Stopping SharePoint from Messing Up Protocol-Relative Links Added with SharePoint Designer

Protocol-relative links are a standard way to avoid mixed content warnings (“This page contains both secure and nonsecure items”) when viewing SharePoint pages. However, if you’re editing a page in SharePoint Designer and try to add one, you’ll find that it doesn’t work forever – SharePoint will eventually mess the link up, usually when you least expect it.

In this video I demonstrate the problem and explain a solution I found to stop SharePoint from messing up protocol-relative links added with SharePoint Designer.

How to fix broken navigation links after SharePoint upgrade or migration

I was recently testing a SharePoint 2007-to-2013 upgrade for a client and was reminded of a problem where links can break in the upgraded/migrated site if the base URL changes along the way.

Here was the scenario:

  1. Client had a 2007 SharePoint site with a base URL similar to http://intranet.
  2. We did a database-attach upgrade to SharePoint 2013 and set up a base URL for testing similar to http://SP-2013:12000 (using a port number rather than host header).
  3. In the upgraded site, some of the links to pages and sub-sites were still referencing the old URL at http://intranet. Other links worked fine and referenced the new URL.

Root cause:

Navigation links that were added by site owners as relative links in the old site continued to work, and links that were added and managed automatically by SharePoint continued to work as well.

Links that were added as absolute links in the old site are what failed to migrate over because they were effectively “hard-coded” to reference the old URL.

Resolution:

The easiest fix was to use a PowerShell script that examined every site collection and site within our upgraded web application and fixed the links in the navigation menus. To do this, the script would look for absolute links that referenced the old base URL and update those links to be relative so they’d work in the new environment.

I checked online and found a few scripts to do this, but they all had problems. Among the problems I found were:

  • Poor coding practices (i.e. not disposing of objects, improper checking of URLs, etc.)
  • Only going 1 or 2 levels deep in the navigation hierarchy and missing deeper links.
  • Checking and fixing links in the Quick Launch menu or the top navigation menu but not both.

So, as a PowerShell guy, I decided to write my own script and avoid the problems I listed above. The client and I ran it earlier today, and all the links were fixed and work fine now.

Here’s the script I used:

###############################################################################
# Configuration variables.
###############################################################################

$WebAppUrl = 'http://newsite.contoso.com'
$OldHostName = 'intranet'

###############################################################################
# Script execution logic.
###############################################################################

function UpdateMenuLinks($topNode) {
	$count = 0
	foreach ($node in $topNode.Children) {
		$uri = New-Object System.Uri($node.Url, [System.UriKind]::RelativeOrAbsolute)
		if ($uri.IsAbsoluteUri -and $uri.Host -eq $OldHostName) {
			$node.Url = $uri.PathAndQuery
			$node.Update()
			$count++
		}
		$subCount = UpdateMenuLinks($node)
		$count += $subCount
	}
	return $count
}

$webApp = Get-SPWebApplication $WebAppUrl -ErrorAction Stop

$webApp.Sites | foreach {
	$site = $_
	try {
		$site.AllWebs | foreach {
			$web = $_
			try {
				"Checking nav links in $($web.Url) ..."
				$fixedTopLinkCount = UpdateMenuLinks($web.Navigation.TopNavigationBar.Parent)
				$fixedLeftLinkCount = UpdateMenuLinks($web.Navigation.QuickLaunch.Parent)
				if ($fixedTopLinkCount -gt 0 -or $fixedLeftLinkCount -gt 0) {
					" - Updated $($fixedLeftLinkCount) quick launch link(s) and $($fixedTopLinkCount) top menu link(s)."
				}
				else {
					" - No links updated."
				}
			}
			finally {
				$web.Dispose()
			}
		}
	}
	finally {
		$site.Dispose()
	}
}

"Done. Finished checking all sites in web application."

The script produces output like this (cut down a lot to save space):

Checking nav links in http://newsite.contoso.com/sites/it ...
- Updated 1 quick launch link(s) and 2 top menu link(s).
Checking nav links in http://newsite.contoso.com/sites/finance ...
- Updated 3 quick launch link(s) and 2 top menu link(s).
Done. Finished checking all sites in web application.

There are two variables to set at the top. One is the URL of the target web application where you want the links fixed (your upgraded/migrated site), and the other is the old host name (base URL without the http/https part) that needs to be searched for.

If you choose to copy and use this script, you do so AT YOUR OWN RISK. I will not be held liable for anything that happens in your environment. As always, I recommend TESTING things like this before you use it in a production environment.

Lastly, this only fixes navigation links in the Quick Launch and top navigation menus. It does not fix links within content such as pages or web parts or in code such as JavaScript code. You’ll either need to fix those manually or write another script to address those things. In my case it wasn’t necessary to automate fixing links to that level, so I didn’t worry about it.

Price about to go up on my SharePoint 2013 timer job development course

I’m about to add new content to my training course on SharePoint 2013 timer job development, and the price will go up on November 24 when the new content is published.

Get lifetime access to the course now – at the current, cheaper price – and receive the updated content at no additional cost when it’s published! Just use the link below.

https://www.udemy.com/developing-custom-timer-jobs-for-sharepoint-2013/

Reporting Options for SharePoint List Data

I came across a blog post today that summarizes the various reporting options for SharePoint and wanted to share it since it’s pretty decent: http://sharepoint-community.net/profiles/blogs/reporting-options-for-sharepoint-lists

Here’s an even shorter summary of reporting options. See the link above for details and links.

  • List views
  • Microsoft Excel / Microsoft Access (client applications and SharePoint services)
  • Custom views or pages created in SharePoint Designer
  • SSRS (SQL Server Reporting Services)
  • PerformancePoint (dashboards / KPIs)
  • Microsoft Visio (not covered in the article but described here)

You can also create a totally custom solution, for example an ASP.NET reporting solution that uses ActiveReports or some other reporting technology.

One of my personal favorites is Microsoft Excel. Excel has three powerful add-ons (all free) that allow normal business users (non-IT people) to do some pretty robust reporting:

Power Query is particularly nice. It’s a newer add-on that provides richer options for getting external data into Excel. For example, it’s aware of SharePoint lists and allows you to pull list data into Excel and even filter, sort, and manipulate it to a certain extent before you use it in tables, charts, or PowerPivot.

Power View is another nice add-on that provides some decent visualizations and basically lets you create some canned reports as worksheets within Excel.

PowerPivot has been around a little longer and essentially lets you work with your data model in Excel as a “mini database.” You can use it to view data in tables, relate the tables together to create joined records, and create some summarized values (called “measures”) for using in pivot tables and charts.

Information Governance: What It Is and Why You Need It

As an information management professional, I’m always interested in trends and ideas around how businesses can get more value from information. However, there’s so much information captured and stored nowadays that many organizations just “hoard” it and don’t do anything truly strategic with it.

If you want to combat information hoarding and do something more strategic, check out the article I published today on information governance:

https://www.linkedin.com/today/post/article/20140905142116-45935709-information-governance-what-it-is-and-why-you-need-it?trk=prof-post