#MSIgnite sessions available in a single spreadsheet

Update (31/01/15): Session spreadsheet updated and now includes 275 sessions.

Those involved with SharePoint, Office 365, Yammer, the communities and the wider industry will already know about the Ignite conference Microsoft have planned for May this year. Microsoft published the conference sessions on the Ignite website this afternoon, introduced through this Office Blog post.

The Office Blog post included a video from Julia White in which she shared what to expect from the conference. She also said in the video “without giving away too much, be the first to see a lot of new technology”, hinting that we will probably see the next versions of SharePoint and Exchange etc. The SharePoint Twitter account also shared the tweet below, with another video (#InBillWeTrust) confirming the next version of SharePoint (SharePoint 2016) will be shared during the conference.

The conference is just around the corner. At the time of writing this post, there are 272 sessions published on the website and I’m sure this will increase in the coming weeks and months. Over a year ago, I created a PowerShell script to help myself and others easily review all the sessions that were planned for the then SharePoint Conference (#SPC14).

You’ll be pleased to know I’ve done something similar again this year, although this year I’ve quickly gone about it using jQuery. I plan to create and share a bookmarklet but until then I’ve shared the first Ignite sessions spreadsheet for your viewing. The latest version of the sessions spreadsheet and jQuery bookmarklet are shared below.

MSIgnite Sessions Spreadsheet

Javascript via JSFiddle

Fingers crossed I can attend #MSIgnite and have the opportunity to meet the great people I met at #SPC14 again!

Working with SharePoint’s Second Stage Recycle Bin in PowerShell

I thought I’d share a PowerShell script that I’ve created to perform a few tasks against a Site Collection Second Stage Recycle Bin (SSRB) in SharePoint.

Remove-SecondStageRecycleBinItems.ps1
Remove-SecondStageRecycleBinItems.ps1

The requirement was to delete items that were older than a set number of days from the Second Stage Recycle Bin (SSRB). A record of each item deleted also needed to be added to a report.  But SharePoint can do this already I hear you say…well yes if a Site Collection quotas and the auditing features are used. In this scenario neither could be.

To display items in the Second State Recycle Bin in a table I used this command.

[code lang=”powershell”]$site.Recyclebin | where { $_.ItemState -eq "SecondStageRecycleBin" -and $_.deleteddate -le $dateDiff} | Format-Table -Property Title, Web, DeletedBy, DeletedDate -Autosize -Wrap
[/code]

Then to remove each item from the Recycle Bin I used the delete command.

[code lang=”powershell”]$site.Recyclebin.Delete($_.ID)[/code]

The full script is shared below. Remember to review, rename and test this script before using it in a production environment.

[code lang=”powershell”]
#——————————————————————————–
#
# Remove-SecondStateRecycleBinItems.ps1
#
# Author: James Callaghan (www.jcallaghan.com)
# Date: April 2014
#
# This script will delete items from the Second Stage Recycle Bin that
# are older than XX days.
#
#——————————————————————————–

Add-PSSnapin Microsoft.SharePoint.PowerShell

#Variables
$i = 0

#SharePoint Site Collection URL
$url = "http://apm.dev.jcallaghan.com"
#$url = Read-Host "Enter a valid URL to a SharePoint Site Collection?"
#if($url -eq ""){write-host "No URL provided." -foregroundcolor Red; Exit}

#How many days ago should items be deleted from?
$deleteFrom = -10
#$deleteFrom = Read-Host "Remove items older than how many days?"
#if($deleteFrom -eq ""){write-host "No value provided." -foregroundcolor Red; Exit}

#Create report in script path
$scriptpath = $MyInvocation.MyCommand.Path
$dir = Split-Path $scriptpath
$report = "$($dir)\DeletedSecondStateRecycleBinItems.csv"

#Date calculations
$dateNow = Get-Date
$dateDiff = $dateNow.AddMinutes(-$deleteFrom)
#$dateDiff = $dateNow.AddDays($deleteFrom)

#Display date/times for review in table
$table = @()
$review = New-Object System.Object
$review | Add-Member -type NoteProperty -Name "Date" -Value "Timestamp now"
$review | Add-Member -type NoteProperty -Name "Value" -Value $dateNow
$table += $review
$review = New-Object System.Object
$review | Add-Member -type NoteProperty -Name "Date" -Value "Files older than"
$review | Add-Member -type NoteProperty -Name "Value" -Value $dateDiff
$table += $review
$table | Format-Table –AutoSize

#Connect to the site
$site = Get-SPsite $url

#Report file and first row
New-Item $report -type file -Force | Out-Null
Add-Content $report "Deleted Items: $($dateNow)"
Add-Content $report "Name, Title, Deleted by, Deleted date, Path, File Guid"

#Get items from the Seconday Stage Recycle Bin (SSRB) that are older than are removel period.
$items = $site.Recyclebin | where { $_.ItemState -eq "SecondStageRecycleBin" -and $_.deleteddate -le $dateDiff}
$site.Recyclebin | where { $_.ItemState -eq "SecondStageRecycleBin" -and $_.deleteddate -le $dateDiff} | Format-Table -Property Title, Web, DeletedBy, DeletedDate -Autosize -Wrap

#Confirm there are items to delete
if($items -ne $null){

#Create prompt
$ok = New-Object System.Management.Automation.Host.ChoiceDescription "&OK","Description."
$cancel = New-Object System.Management.Automation.Host.ChoiceDescription "&CANCEL","Description."
$options = [System.Management.Automation.Host.ChoiceDescription[]]($ok, $cancel)
$title = "Confirm"; $message = "Delete items from Second Stage Recycle Bin?"
$result = $host.ui.PromptForChoice($title, $message, $options, 1)

switch ($result) {
0{
#Get items to be deleted
$site.Recyclebin | where { $_.ItemState -eq "SecondStageRecycleBin" -and $_.deleteddate -le $dateDiff} | foreach{
#Add entry to report
Add-Content $report "$($_.LeafName),$($_.Title),$($_.deletedbyname),$($_.deleteddate),$($_.Dirname),$($_.Id)"

#Delete item by ID
$site.Recyclebin.Delete($_.ID)

$i++
}
write-host "$($i) items removed from Second Stage Recycle Bin."
}1{
write-host "Cancelled by user." -foregroundcolor Red
}
}
}else{
write-host "No files were found in the Second Stage Recycle Bin." -foregroundcolor Red
}

#Dispose
$site.dispose();
[/code]

One quirk I found while creating the script was that through the web browser, SharePoint reported the time each file was deleted correctly whereas in PowerShell, the time was not honouring GMT summer time.

British Summer Time  in SharePoint vs. PowerShell
British Summer Time in SharePoint vs. PowerShell

Enjoy and delete carefully!

All #SPC14 sessions available in a single spreadsheet!

Update: Wednesday, 8th January 2014. This post has seen an incredible amount of traffic which I have found to be a very rewarding experience- thank you! I’ve lived up to my word and managed to export the speaker information. Both the spreadsheet and PowerShell script have been updated to include this information.

Something I have found frustrating with the SharePoint Conference 2014 website over the holidays is that you have to browse through the sessions as search results pages. It makes planning how I want to fill my days at the conference very difficult.

Spreadsheet containing all the SharePoint Conference 2013 sessions
Spreadsheet containing all the SharePoint Conference 2014 sessions

I also wanted to sit down with my colleagues to see if there are any particular sessions that interest them. Without all the session being available in a format such as a spreadsheet this would become a very tiresome task.

There was no way I was going to do this by hand – at this time there is about 183 published sessions and 12 pieces of information per session that would require me to use copy and paste 4392 times and click between a browser and Excel 600 times…no thank you

Jumping the gun the a little maybe as I have yet to register (this is top of my to-do list when I’m back in the office on Monday and I’ll kick myself if this is available when you register!) but I broke out PowerShell and wrote a script to download all the information for the sessions from the SharePoint Conference (#SPC14) website to a spreadsheet – both of which you can download.

PowerShell script to export all the #SPC14 sessions to Excel
PowerShell script to export all the #SPC14 sessions to Excel

A spreadsheet of all the SPC14 sessions can be downloaded with this link and the script is available here.

By no means is this script particularly complex or elegant – but I really wanted this information in a spreadsheet and pretty fast so forgive me if it is not up to my usual standard…the key thing is I achieved what I set out to do and can share it with you all. The last piece of information which I’m still trying to export are the speakers for the sessions – I’ll update if I manage it.

I hope you find the #SPC14 session spreadsheet helpful – see you at the conference!

Using PowerShell with Windows Azure

If you’re working with Windows Azure and want to use PowerShell to perform management tasks you will first need to install and configure Windows Azure PowerShell as per this article “How to install and configure Windows Azure PowerShell“.

  1. Download and install the Microsoft Web Platform Installer
  2. Launch the Microsoft Web Platform Installer
  3. Select the Windows Azure PowerShell and then click install
  4. Launch PowerShell as an Administrator
  5. Type get-help *Azure* to see all the Windows Azure cmdlets – you will be asked to update help
  6. Download your Windows Azure subscription publish settings file by typing Get-AzurePublishSettingsFile or by browsing to the download publish profile page
  7. Save the publish settings file to a directory – in my case I store this alongside my Windows Azure scripts directory that I have synchronised with Dropbox
  8. Import the publish settings file by typing Import-AzurePublishSettingsFile <PathToPublishSettingsFiles>
  9. Check to see that you can are connected to your Windows Azure subscription by entering Get-AzureSubscription which should return information about your subscription.

Here are a couple of useful links to get you started – Windows Azure Management Cmdlets and Windows Azure Script Centre

That’s it – you should now be able to manage Windows Azure using PowerShell.

Working with Managed Paths in SharePoint using PowerShell

Quite a common requirement for implementations of SharePoint that I am involved in, is to create new managed paths for a given web application.

While it is a simple task to perform via Central Administration, I inevitably turn to PowerShell to achieve this so that I can then include it as part of larger configuration or deployment scripts.

Define managed paths in Central Administration
Define managed paths in Central Administration

To manage managed paths in SharePoint we use the PowerShell Get-SPManagedPathNew-SPManagedPath and Remove-SPManagedPath cmdlets.

Reviewing existing managed paths

To get a list of all the managed paths for a given web application we use the Get-SPManagedPath cmdlet as shown below.

[code lang=”powershell”]
Get-SPManagedPath -WebApplication http://demo.jcallaghan.com
[/code]

Get-SPManagedPaths PowerShell Cmdlet
Get-SPManagedPaths PowerShell Cmdlet

Creating a new explicit path

Explicit managed paths only allow one site collection to be created at specific path. An example of this is the root site collection of a web application which has an explicit managed path of “/” (http://demo.jcallaghan.com).

To add a new explicit managed path to a web application we use the New-SPManagedPath cmdlet and include the -Explicit parameter.

[code lang=”powershell”]
New-SPManagedPath -RelativeURL "projects-directory" -Explicit -WebApplication http://demo.jcallaghan.com
[/code]

Adding a wildcard managed path

Wildcard managed paths allow one or more site collections to exist at a specified path. This is the same as the default ‘sites’ managed path that we should all be familiar with (http://demo.jcallaghan.com/sites/projectxyz).

To add a wildcard managed path we run the command as we did for an explicit managed path however we don’t include the -Explicit parameter.

[code lang=”powershell”]
New-SPManagedPath -RelativeURL "projects" -WebApplication http://demo.jcallaghan.com
[/code]

Custom managed paths added
Custom managed paths added

Removing an existing managed path

There may be times when you need to remove managed paths. This can be done by running the Remove-SPManagedPath cmdlet and specifying the name of the managed path to be removed and what web application to remove it from. When removing a managed path you will be prompted to confirm the removal action – this can be silenced by adding -confirm:$false to the command.

[code lang=”powershell”]
Remove-SPManagedPath "sites" -WebApplication http://demo.jcallaghan.com
[/code]

Conclusion

Using the SPManagedPath nouns in PowerShell we can get a list of existing managed paths, create explicit or wildcard managed paths and also remove existing managed paths for a given web application.

[code lang=”powershell”]
## Get managed paths
Get-SPManagedPath -WebApplication http://demo.jcallaghan.com

## New explicit managed path
New-SPManagedPath -RelativeURL "projects-directory" -Explicit -WebApplication http://demo.jcallaghan.com

## New wildcard managed path
New-SPManagedPath -RelativeURL "projects" -WebApplication http://demo.jcallghan.com

## Remove existing managed path
Remove-SPManagedPath "sites" -WebApplication http://demo.jcallaghan.com
[/code]