Question

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.?

Était-ce utile?

La solution

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.

How to: Run PowerShell Scripts from Task Scheduler

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top