cls
Remove-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
Add-PSSnapin Microsoft.SharePoint.Powershell
# varable description
$webUrl = Read-Host "Enter site URL (Eg: http://<HostName>:1111/sites/sitecollname )"
$web = Get-SPWeb $webUrl
$libraryName = Read-Host "Enter Library Name"
$libraryDescription = Read-Host "Enter description"
$libraryTemplate = [Microsoft.SharePoint.SPListTemplateType]::DocumentLibrary;
# Adding Library
try
{
$web.Lists.Add($libraryName,$libraryDescription,$libraryTemplate);
$web.Update();
}
catch
{
write-host "Error" $_.exception
$errorlabel = $true
}
finally
{
if($web -ne $null)
{
$web.Dispose()
}
}
Remove-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
Add-PSSnapin Microsoft.SharePoint.Powershell
# varable description
$webUrl = Read-Host "Enter site URL (Eg: http://<HostName>:1111/sites/sitecollname )"
$web = Get-SPWeb $webUrl
$libraryName = Read-Host "Enter Library Name"
$libraryDescription = Read-Host "Enter description"
$libraryTemplate = [Microsoft.SharePoint.SPListTemplateType]::DocumentLibrary;
# Adding Library
try
{
$web.Lists.Add($libraryName,$libraryDescription,$libraryTemplate);
$web.Update();
}
catch
{
write-host "Error" $_.exception
$errorlabel = $true
}
finally
{
if($web -ne $null)
{
$web.Dispose()
}
}
No comments:
Post a Comment