This project is read-only.

1             Introduction

Publishing script for SharePoint 2010 automates the publishing, approving of SharePoint contents like pages, xsl sheets and everything that is residing inside a document library with versioning and content approval enabled. Generally, in a SharePoint 2010 WCM development project, multiple items get checked out during development. Towards, the end of the project during deployment, the developer or tester has to manually find all the unpublished items. Checking in these items and approving those manually is a time consuming task. This script automates these all manual steps. You can use this script for “bulk publishing” of multiple documents on SharePoint 2010.

2             Features

Following is the list of features provided by the tool

  •  Publishing files with specific extension
  •  Can Check-in folders
  • You may use this script to check in, approve and publish contents on a specific sub site. This script can recursively check for the checked out contents on sub sites of current site, and then check in, approve and publish that content.
  • Publishing items inside folders of document library. This script is specifically written to be used only on a list of “Document Library” type.

3             Prerequisites

  • SharePoint 2010 Management shell (This gets installed automatically with the SharePoint 2010 installation)
  • You must have an administrative access to the farm on which this script is to be used
  • Administrative access to site and sub sites on which this script is gonging to run

4             Installation Instructions

For installing this script on your local machine follow these instructions

  • Create folder on C drive say “PowerShell”
  • Copy “PublishSPContent.ps1” to this folder
  • Open “SharePoint 2010 Management Shell”
  • CD to this folder
  • Execute command “.\PublishSPContent.ps1”

4.1             Sample Commands

  • For checking in, approving and publishing contents on any site collection and all sub sites

.\PublishSContent.ps1 –Url “http://yoursite” –Recursive $true

  • For checking in, approving and publishing contents on any sub site and children of sub site

.\PublishSContent.ps1 –Url “http://yoursite/subsite” –Recursive $true

  • For checking in, approving and publishing file of specific extension

.\PublishSContent.ps1 –Url “http://yoursite/subsite” –Recursive $true –Extension “.aspx”

  • For specifying custom check in and approval comment

.\PublishSContent.ps1 –Url “http://yoursite” –Recursive $true –Comment “My Approval”

  • For Setting “ApproveFolders” to “False”

.\PublishSContent.ps1 –Url “http://yoursite/subsite” –Recursive $true –ApproveFolders $false

5             Command line parameters

5.1             “-Url”

Type

Description

Category

Required Parameter

Value

Url of Site collection or sub site

Format

String

Default Value

N.A.

5.2             “-Extension”

Type

Description

Category

Optional Parameter

Value

Extension of files to be approved (e.g “.aspx”)

Format

String

Default Value

“.*”

5.3             “-Comment”

Type

Description

Category

Optional Parameter

Value

Comment for checking in/publishing file

Format

String

Default Value

“System Approval”

5.4             “-ApproveFolders”

Type

Description

Category

Optional Parameter

Value

True or False based upon the requirement

Format

Boolean

Default Value

$true

5.5             “-Recursive”

Type

Description

Category

Optional Parameter

Value

True if you want to recursively publish contents of current site and all subsites

Format

Boolean

Default Value

$false

6             Troubleshooting

  • If you get any error related to permissions while executing this script, Right click on ps1 file go to properties -> Security and then check if the “Unblock” option is available. Click on “Unblock button” to grant execute permission to this script.
  • Always execute this script under the user account which has “Owner” authority for the current site

Last edited Jan 22, 2011 at 7:49 AM by yojoshi, version 1

Comments

No comments yet.