Tuesday, 25 February 2014

Set Synchronous property for Asynchronous Event receiver through PowerShell

Set Synchronous property for Asynchronous Event receiver through PowerShell:-

Note : Event Receiver is associated with a Content Type.

#Loading Snap in for Microsoft.Sharepoint.Powershell
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}

if ($snapin -eq $null)
{
Write-Host "Loading SharePoint Powershell Snapin" -ForegroundColor Green
$snapin = Add-PSSnapin "Microsoft.Sharepoint.Powershell"

Write-Host $snapin
}

$SiteUrl="http://Testsite:8080"
$web = Get-SPWeb $SiteUrl
$ctype = $web.ContentTypes["Content Type Name"]
Write-Host $SiteUrl
Write-Host $ctype.EventReceivers.Count
$eventReceiver=$ctype.EventReceivers[0]

Write-Host "Before Change.."
Write-Host $eventReceiver.Synchronization

No comments:

Post a Comment