You would like to upload documents to a document library via Powershell and disable events that might be fired or don't start workflows on this item change?
How to set the EventFiringEnabled property from Powershell?
Solution:
Actually this is not really something you generally do from PowerShell. The purpose of EventFiringEnabled is to prevent an event receiver from triggering the same event recursively.
However, you can switch it off for the thread upon which your PowerShell code is running:
$myAss = [Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint");
$type = $myAss.GetType("Microsoft.SharePoint.SPEventManager");
$prop = $type.GetProperty([string]"EventFiringDisabled",[System.Reflection.BindingFlags] ([System.Reflection.BindingFlags]::NonPublic -bor [System.Reflection.BindingFlags]::Static));
$prop.SetValue($null, $true, $null);
#code to update list goes here!
Keine Kommentare:
Kommentar veröffentlichen