Pause, Resume and Run a Reporting Services SharePoint Shared Schedule

I’ve recently re-entered the world of SharePoint Reporting Services integration and needed a way to run a shared schedule from a SQL job.

The scenario is this – We have a job that runs in the morning to populate the data warehouse, after the data warehouse it populates the cubes. What I want to happen next is for a number of reports to run against the cubes to warm up the SSAS cache and wake up reporting services ready for the business users.

So I have created the stored proc below to do just that – to make it a bit more useful I have also built in the ability to enable or disable a shared schedule. That way if the morning load fails we can programmatically disable the daily reports so they don’t go out with missing data.

Here’s the sproc….


USE ReportServer
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[usp_Control_SharedSchedules]
(
@Schedule varchar(200)
,@Action varchar(8)
)
AS
BEGIN
/*
============================================================
= usp_Control_SharedSchedules 'Runs After Cube Processing Complete', 'Enable'
============================================================
= Description
= ------------------
= Author : Dan Wakefield
= Created Date : 1 Aug 2014
=
= History
= ------------------
= Created to allow us to kick off a set of reports to warm the cache
= after the cubes have finished processing.
=
= Can also be used to disable a schedule if the load fails and enable it again after it succeeds.
=
= Input
= --------
= @ScheduleName = Name of shared schedule e.g. 'Daily 10am'
= @Action = What do you want to happen? Disable, Enable or Run
(enable means it will run next time it reaches its usual scheduled time, run means run now)
=
= Return
= ----------
= RS
============================================================
*/
SET DATEFIRST 1
SET NOCOUNT ON
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

/*
===============================================================================================
= Declarations
===============================================================================================
*/

DECLARE @job_name VARCHAR(128)

SELECT @job_name = ScheduleID
FROM Schedule
WHERE Name = @Schedule

/*
===============================================================================================
= Processing Code
===============================================================================================
*/

IF @Action = 'Run'
BEGIN
-- Run a shared schedule
-- This will kick off all reports that are tied to the named shared schedule
EXEC msdb.dbo.sp_start_job @job_name
END

IF @Action = 'Disable'
BEGIN
-- Disable schedule
-- No reportts tied to this schedule will run until re-enabled
UPDATE MSDB.dbo.sysjobs
SET Enabled = 0
WHERE Name = @job_name;
END

IF @Action = 'Enable'
BEGIN
-- Enable schedule
-- All reports tied to this schedule will run next time the scheduled time arrives
UPDATE MSDB.dbo.sysjobs
SET Enabled = 1
WHERE Name = @job_name;
END

END

Exporting user list from SharePoint 2010

Here’s the magic URL – Just replace the bits in square brackets with the appropriate values for your site

http://[YOURSITE]/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List=[LISTID]&View=[VIEWID]&CacheControl=1

[YOURSITE] – This is the main root of your SharePoint url

[LISTID] and [VIEWID] – Get these by going to ‘Site Actions’ -> ‘Site Settings’ -> ‘People and Groups’.  Click on ‘Settings’ -> ‘List Settings’ then down at the bottom under ‘Views’ click on ‘List View’.  Now look in your URL and you will see ‘List=’ and ‘&View=’ – These are the GUIDS you need for LISTID and VIEWID.

Once you have constructed your URL in notepad, paste it into internet explorer and hit enter – This should then prompt you to open or save the results – Click open and follow the instructions in Excel.

SharePoint 2010 User Profile Service vs. NETBIOS

Recently I’ve had a niggling problem with SharePoint 2010 UPS – My user profiles were appearing with the wrong domain prefix and it was throwing out the people pickers and org charts in my sites.

It boiled down to the fact that our company NETBIOS name for the domain doesn’t match the first part of our fully qualified domain name.

E.g. NETBIOS name is DanCorp but FQDN is corp.dan.com

The problem here is that SharePoint has a setting called NetBIOSDomainNamesEnabled which by default is set to False.

The solution is to set this to True (see below), then delete your AD connection in Central Admin, recreate it and run a full sync.

BEWARE – Our tech support guys tried this with deleting the AD connection and it made our domain controllers VERY upset, we had user authentication issues all over the place.  If you follow the steps below you should be fine but be sure to delete and recreate the connection to AD in Central Admin before running a synchronisation.

Step by step

1) set NetBIOSDomainNamesEnabled to True through Powershell (script below)

2) Delete the sync connection in Central Admin (‘Configure Synchronisation Connections’ on the manage user profile service screen).

3) Recreate the connection.

4) Run a full synchronisation.

Powershell script (save this as a .PS1 file and run it using ‘SharePoint 2010 Management Shell’)

$ServiceApps = Get-SPServiceApplication

$UserProfileServiceApp = “”

foreach ($sa in $ServiceApps)

{if ($sa.DisplayName -eq “User Profile Service”)

{$UserProfileServiceApp = $sa}

}

$UserProfileServiceApp.NetBIOSDomainNamesEnabled = 1

$UserProfileServiceApp.Update()

Annoying prompt opening PDFs in SharePoint 2010

Today I came across an issue where I created a doc library and uploaded some PDFs to it – When you click on a PDF it popped up a prompt saying open read only or edit.

When would I want to edit a pdf? (not very often in my case) – So I wanted to get rid of this.

Jess Collicot gave the answer (http://www.deliveron.com/blog/post/Fixing-Prompts-When-Opening-PDFs-in-SharePoint-2010.aspx)

Basically you have to edit an XML document in the 14 hive of your sharepoint server(s) – The document is called DOCICON.XML and can be found in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML (or your equivalent 14 hive location)

Find the node starting <Mapping Key=”pdf” Value….

and add OpenControl=”” to the end (inside the triangular brackets) – Mine now looks like this…

<Mapping Key=”pdf” Value=”pdficon.gif” OpenControl=”” />

Then a quick IIS reset and the prompt is gone – PDFs now open straight in the browser nice and quick. 🙂