In this article we will be seeing how to block or unblock edit for the items on
hold in SharePoint site.
Refer this article to create a hold and
add or remove the hold to the item through UI.
Normally when you create a hold and add the item to a hold you could see the
padlock on the items as shown in the following
If you try to edit the item you will be getting the following error
You can change the read-only property for the items on hold using "SetLockHoldItemsProperty".
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
Microsoft.SharePoint;
using
Microsoft.Office.RecordsManagement.Holds;
namespace
Holds
{
class Program
{
static void
Main(string[] args)
{
using (SPSite
site = new SPSite("http://serverName:1111/"))
{
using (SPWeb
web = site.RootWeb)
{
//Set the setting of whether items
on hold in the specified site should be locked (block edit).
Hold.SetLockHoldItemsProperty(site,
false);
}
}
}
}
}
Hold.SetLockHoldItemsProperty(site, false) – When you make the bool value to
false you wont be seeing the padlock and you can edit the item on hold.
Using PowerShell:
$siteURL="http://serverName:1111/"
$site=Get-SPSite $siteURL
$web=$site.RootWeb
[Microsoft.Office.RecordsManagement.Holds.Hold]::SetLockHoldItemsProperty
($site,$false)
$web.Dispose()
$site.Dispose()