Created
August 20, 2016 08:05
-
-
Save sabique/d42eb05cd29e352945c035f31bf80978 to your computer and use it in GitHub Desktop.
SharePoint 2010 - Power Shell script to get list of documents from a library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cls | |
if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) { | |
Add-PSSnapin Microsoft.SharePoint.PowerShell; | |
} | |
$sourceWebURL = "http://sp2010/sites/" | |
$sourceListName = "Library Name" | |
$spSourceWeb = Get-SPWeb $sourceWebURL | |
$spSourceList = $spSourceWeb.Lists[$sourceListName] | |
$spSourceItems = $spSourceList.Items | where {$_['Title'] -like "*Lorem*"} | |
$spSourceItems | ForEach-Object { | |
Write-Host $_['ID'] | |
Write-Host $_['Name'] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 6 : Write the URL of your site.
Line 7 : Write the name of your Library
Line 11 : Write the condition for your script.
Line 14 & 15 : Name of the columns you want to fetch.