Sharepoint 2010 - refresh list job
Domanda
I need to refresh all my lists in server daily.
To refresh one list I use this powershell:
$web = Get-SPWeb http://Server/ListLocation
$list = $web.Lists["ListA"]
foreach ($item in $list.Items)
{
$item.UpdateOverwriteVersion();
}
How to refresh all lists? And how do you create a job so it runs daily at 8:00 p.m.?
Soluzione
You can use the PowerShell command to refresh all lists:
$web = Get-SPWeb Server/ListLocation
$lists = $web.Lists
foreach ($list in $Lists) {
foreach ($item in $list.Items)
{
$item.UpdateOverwriteVersion();
}
}
To run the script daily, I recommend you save the script as ".ps1" file and using Windows Task Scheduler to run the script file daily.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange