Categories
SharePoint

Falling foul of SharePoint SSL

Recently, despite ensuring the SSL certificates within Internet Information Services (IIS) were updated ahead of their expiry, I fell foul of the hidden certificate within SharePoint 2013’s Security Token Service. In my defence, this is a certificate not mentioned within IIS or the Central Administration site. Its one of those lovely settings that can only be seen, analysed, and amended via PowerShell commands. Once you know/remember its there, its relatively straight forward to update.

$path = "C:\certificate.pfx"
$password = "thepassword"

$certificate = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 $path, $password, 20

Set-SPSecurityTokenServiceConfig -ImportSigningCertificate $certificate

certutil -addstore -enterprise -f -v root $certificate

iisreset

net stop SPTimerV4
net start SPTimerV4

See: Replace the STS certificate for the on-premises environment

 

Categories
SharePoint

SharePoint Workflows, Emails, and Groups

Another note to self. When wanting a SharePoint workflow to send an email to the members of a specific SharePoint group:

  1. ensure that the group has at least Read access to the site
  2. within the group settings, check that “Who can view the membership of this group?” is set to Everyone
Categories
SharePoint

Migrating Lists from SharePoint 2010 to SharePoint 2013

While waiting for a purchase order for Sharegate to be approved, I needed to quickly migrate content of an old SharePoint 2010 list to our new SharePoint 2013 farm. Out of the box this isn’t straight forward, and Microsoft recommend a complete backup, move and upgrade approach for the entire content database. Time-wise, this wasn’t an option and seemed overkill for a single list.

In the past I’ve experimented by writing a PowerShell script to export the list’s content to a .CSV file and it’s attachments into folders, and then another script to suck it back into the destination site.

Before heading down that route again, I searched for a different approach and found the Fast & Cheap method documented by Vlad Catrinescu.

It basically involves:

  1. Exporting the list from SharePoint 2010 via the Backup and Restore option within Central Administration.
  2. Changing the extension of the resulting files from .cmp to .cab, and extracting their contents.
  3. Amending the versions stated within the SystemData.xml file from 14.0.x.x to 15.0.x.x
  4. Repackaging them back into a .cab file via CapPack.
  5. Changing the extension from .cab back to .cmp
  6. Importing the list into SharePoint 2013 via PowerShell.
Import-SPWeb -Identity http://mysharepointsite -Path \\temp\SharePointList.cmp -IncludeUserSecurity -Verbose

It seems to have worked like a charm!

Categories
SharePoint

SharePoint 2013 and IE11 Support

Very odd. Even though I’ve been using Internet Explorer 11 and SharePoint 2013 together for some time, this morning, when I created a new Site Collection and added a Calendar, it wasn’t rendering as it should and many links were broken.

After a little research,  it seems that IE11 doesn’t work out-of-the-box with SharePoint 2013 and boils down to an inconsistency with the X-UA-Compatible meta tag.

To overcome this, I added a new URL rewrite rule into IIS that spoofs the User Agent of the visitor’s browser, forcing the SharePoint page to be rendered correctly. No Compatibility View required.

Categories
SharePoint

Using the Content Query web part in SharePoint without activating the Publishing feature

You can use the Content Query web part within a SharePoint site without activating publishing feature (which you may want to do as activating the feature introduces and changes a lot of options):

  1. Go to the Web Part Gallery within an existing publishing site
  2. Export the ContentQuery.webpart file and upload it to the Web Part Gallery of the destination site
  3. Copy the three .XSL documents (Header, ItemStyle, ContentQueryMain) from the XSL Style Sheets folder within the Style Library and transfer them to the destination site
Categories
SharePoint

SharePoint 2013 & PerformancePoint

Note to self: Instead of banging your head for two days trying to resolve the issue of PerformancePoint reports not displaying. When you see a “Failed to Sql Query data XEvent collector on sqldbserver…” message within the log files, first ensure that the SharePoint farm account has been granted the serveradmin role upon the SQL server.

See: Failed to Sql Query data XEvent collector on sqldbserver. The error is Object reference not set to an instance of an object. And other SQL related errors in SharePoint 2013

Categories
Coding

Value does not fall within the expected range

The following code, which was supposed to update the “Current” Composed Look, was throwing a “value does not fall within the expected range” error each time I ran it.

SPWeb web = properties.Feature.Parent as SPWeb;
SPList gallery = web.GetCatalog(SPListTemplateType.DesignCatalog);

if (gallery != null)
{
    SPQuery q = new SPQuery();
    q.RowLimit = 1;
    q.Query = "<Where><Eq><FieldRef Name='DisplayOrder'/><Value Type='Number'>0</Value></Eq></Where>";
    q.ViewFields = "<FieldRef Name='DisplayOrder'/>";
    q.ViewFieldsOnly = true;

    SPListItemCollection items = gallery.GetItems(q);

    foreach (SPListItem item in items)
    {
        item["MasterPageUrl"] = web.MasterUrl;
        item.Update();
    }

}

After a lot of head scratching, it boiled down to the ViewFieldsOnly property which, which I had left set to true. Doh! Updating the property to false corrected the error.

See: SPQuery.ViewFieldsOnly property

Categories
SharePoint

The URL is not available, does not reference a SharePoint site, or you do not have permission to connect

This is a handy thing to remember for an issue I just ran into. When you try to connect to a SharePoint URL from Dashboard Designer, you may see the following prompt:

“The URL is not available, does not reference a SharePoint site, or you do not have permission to connect”

To resolve the issue I had to ensure that the Service Account which was running PerformancePoint Services had been given owner-level access to the Content database.

Categories
SharePoint

SharePoint Content Type IDs

This is a handy PowerShell snippet for returning a list of all Content Types and their IDs within a SharePoint site.

$site = Get-SPSite http://www.domain.com
$web = $site.RootWeb
ForEach( $contentType in $web.ContentTypes ) { Write-Host $contentType.Name": "$contentType.ID }
Categories
SharePoint

SharePoint 2013: Focus on Content

SharePoint 2013 has introduced a small Focus on Content icon to the ribbon bar which, for the MasterPages that support it, will show and hide portions of the page when clicked. This can be useful for hiding non-essential page elements.

When the icon is clicked, JavaScript will do two things:

  1. It creates a cookie, so the selection is remembered the next time the page is visited.
  2. It adds a new ms-fullscreenmode class to the page’s BODY tag.

So, via CSS, we can decide which elements of the page should be hidden via the Focus on Content functionality.

.ms-fullscreenmode #nonessentialcontent { display: none; }