Friday, 21 October 2011

How to Create a Form Library using Powershell script in Sharepoint 2007 and Sharepoint 2010


Someone expressed his needs to have a powershell script to create FormLibrary.
Hence I have written the below script and it works in both Sharepoint 2007 and Sharepoint 2010.
This code can be further modified to create other types of libraries as well.
Hence I am sharing my code here:



function GetHelp() {

$HelpText = @"

This script will create a form library.


function RahulFormLibraryCreation() {

write-host "This script will create a form library for you"
        write-host "Please enter your site url"
        $siteURL = read-host
        write-host "Please enter name of the form library"
        $library = read-host
        write-host "Please enter description of your form library"
        $desctiption = read-host
        $site = New-Object Microsoft.SharePoint.SPSite($siteURL)
        $web = $site.OpenWeb()
        $template = [Microsoft.Sharepoint.SPListTemplateType]::XMLForm

if($help) { GetHelp; Continue }
else { RahulFormLibraryCreation }

I hope this will help you out.

Rahul Rashu

No comments:

Post a Comment