Triggering of Confluence Wiki from SharePoint via PowerShell

One of the most notorious project tasks is the Integration of SharePoint with competitive solutions. One of them is Atlassian Confluence Wiki. In the recent past the integration requests of SharePoint with Confluence are becoming more frequent.

This task can be solved through the usage of Atlassian Confluence SharePoint Connector. But how about those boring routine jobs as the creation of Confluence Wiki spaces? In the past few years the SharePoint Team got used to PowerShell automated approval and creation procedures of SharePoint Site Collections.

The solution of choice in this case is Confluence CLI (Command Line Interface). To connect SharePoint with Confluence, the CLI Plugin has to be installed and activated on the Confluence server. On the SharePoint farm Java Runtime and CLI client for Windows are needed.

The space requestor creates a new list entry in a SharePoint request list and enters the necessary information as space name, space key and space owner in the list form. The PowerShell script for the Confluence Wiki space creation can be started via Windows scheduler as usual.

The PowerShell script checks the SharePoint-Confluence space request list for new entries. As soon as there are new entries, CLI based batches for the SharePoint-Confluence connect and space creation are started. A few seconds later the new Confluence spaces are created and the permissions set. Following this, an approval mail to the requestor containing the space URL has to be sent and the newly created space has to be tagged in the SharePoint list as done.

Add-PSSnapinMicrosoft.SharePoint.PowerShell-EASilentlyContinue

 

#Variables

$webURL=http://fqdn

$listName=“ConfWiki List”

 

#Get the SPWeb object and save it to a variable

$web=Get-SPWeb$webURL

 

#Get the SPList object to retrieve the “ConfWiki List”

$list=$web.Lists[$listName]

 

#Get all items in this list and save them to a variable

$items=$list.items

 

#Go through all items

foreach($itemin$items)

{

#If the “ConfWiki” column value equals “no” call createSpace and set column to yes

if($item[“ConfWiki”]-eq“no”)

{

$SpaceKey=$item[“SpaceKey”]

$SpaceTitle=$item[“SpaceTitle”]

 

cmd.exe/C“E:\confluence-cli-4.5.0\createSpace.bat $SpaceKey$SpaceTitle

 

#Change the value of the “ConfWiki” column

$item[“ConfWiki”]=“yes”

 

#Update the item

$item.Update()}}

Confluence WebParts in SharePoint and SharePoint Macros in Confluence Wiki:

Confluence WebParts in SharePoint

SharePoint Macros in Confluence Wiki

This entry was posted in SharePoint 2013 and tagged . Bookmark the permalink.