In this article we will be seeing how to release a hold in SharePoint 2010 using PowerShell and C#. In this article
Release a hold using c#:
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) { //Release a Hold SPList list = web.Lists["Holds"]; SPListItem item = list.Items[0]; Hold.ReleaseHold(item, "Release the hold"); } } } } } Release a hold using PowerShell: $siteURL="http://serverName:1111/" $site=Get-SPSite $siteURL $web=$site.RootWeb $list = $web.Lists["Holds"] $item=$list.Items[0]; [Microsoft.Office.RecordsManagement.Holds.Hold]::ReleaseHold($item,"Release the Hold") $web.Dispose() $site.Dispose()
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: