0

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

  • 1
    If this is a SharePoint on-prem requirement (which it looks like), then you can create a SharePoint timer job to achieve this. If you don't want a timer job, then the powershell you are using can be scheduled through Windows scheduler in a server machine after making necessary modifications to refresh all required lists. – UBK May 9 at 2:41
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.