Last active
August 20, 2016 08:45
-
-
Save sabique/9b0aa1c24a8994e8f16d4434d89eb405 to your computer and use it in GitHub Desktop.
SharePoint 2010 : Update the value of a column in 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*"} | |
$exdate = '{0:M/dd/yyyy hh:mm:ss tt}' -f (Get-Date) | |
$spSourceItems | ForEach-Object { | |
$_['Created'] = $exdate | |
$_.update() | |
} |
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 15 : Name of the columns you want to update.