I have the following PowerShell script which will update the TemplateUrl field for all forms in a form library.

$newTemplateUrl = "http://SPSERVER/FormServerTemplates/NewFormTemplate.xsn"
$web = Get-SPWeb -Identity "http://SPSERVER/"
$library = $web.Lists["Main Form Library"]

ForEach ($item in $library.Items) {
    $item["TemplateUrl"] = $newTemplateUrl

This works fine for 75% of the forms in the library. However for the remaining 25% the following error occurs:

Exception calling "SystemUpdate" with "0" argument(s): "The file Main Form Library/0000803.xml has been modified by DOMAIN\username on 11 Apr 2013 12:06:55 -0400."

From similar questions on this site it seems as though event receivers can cause the same error. There are event receivers on the library which have been created by SharePoint Designer workflows. However, event receivers are only a problem if you are trying to apply multiple updates to the same item. The first update triggers the event receiver which then updates the item before the second can occurs.

In the PowerShell script above there is only 1 update to the item and the modified date in the error is 6+ months in the past. For those 2 reasons I do not think the problem is the event receivers.

Versioning is enabled in the library so I have also tried changing '$item.SystemUpdate()' to '$item.SystemUpdate($FALSE)' which also did not solve the problem.

2 Answers 2


Are the event receivers for before or after events? After events can cause the problem because they are asynchronous. I would make them synchronous temporarily and execute the script again.

For working with event receivers with PowerShell check my post here

An example from the post to make an event receiver synchronous:

Add-PSSnapin Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue

$web = Get-SPWeb -Identity http://...
$list = $web.GetList($web.Url + "/Lists/" + “list name”)

$type = "ItemAdded" #or any other type, like ItemDeleting, ItemAdding, ItemUpdating, ...

$numberOfEventReceivers = $list.EventReceivers.Count

if ($numberOfEventReceivers -gt 0)
 for( $index = $numberOfEventReceivers -1; $index -gt -1; $index–-)
 $receiver = $list.EventReceivers[$index] ;
 $name = $receiver.Name
 $typ = $receiver.Type ;

 if ($typ -eq $type)  #or you can check ($name -eq "event receiver's name") if you have more then one event receivers of the same type
 $receiver.Synchronization = "Synchronous"
 Write-Host "Event receiver " $name " is changed to Synchronous"
 Write-Host " There is no EventReceiver of type " $type " registered for this list "

  • I have just tried this and after changing the event receivers to Synchronous the error still occurs. Commented Nov 12, 2013 at 10:37
  • Can be that those forms are on Checked-Out state? Commented Nov 12, 2013 at 10:43
  • None of the forms in the library are checked out. Commented Nov 12, 2013 at 10:45

After countless hours trying to find the problem I ended up finding a work around by moving the files to another library and then moving them back to the original. By using the Site Content & Structure tool I was able to preserve the created, created by, modified and modified by fields.

  • This isn't really an answer... More of a situation report. It isn't really helpful.
    – user43832
    Commented Aug 20, 2019 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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