Friday 8 May 2015

PowerShell Script to get Items from SharePoint Calendar List




The below script gets all of the items from the "Calendar" list (or any other list)


cls
if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) {
    Add-PSSnapin Microsoft.SharePoint.PowerShell;

$sourceWebURL = "http://SharePointSiteURL"
$sourceListName = "Calendar"
$spSourceWeb = Get-SPWeb $sourceWebURL
$spSourceList = $spSourceWeb.Lists[$sourceListName]
$spSourceItems = $spSourceList.Items
$spSourceItems | ForEach-Object {
Write-Host $_['Name']
Write-Host $_['Title']
Write-Host $_['Description']
}

No comments:

Post a Comment