In this article we will be seeing how to get the list of holds for the specified
list item using powershell and programmatically in SharePoint 2010.
For Holds and Hold Reports in SharePoint 2010
http://www.c-sharpcorner.com/UploadFile/anavijai/5103/ (Copy the
hyperlink).
I have created two hold items "HR" and "Finance" in the Holds list
Which is available in Site Actions => Site Settings => Hold and eDiscovery =>
Holds.
In the Shared documents I have an item "New" for which both "HR" and "Finance"
holds are added.
Programmatically get the list of holds for the item "New":
Gets the list of holds for the item "New" using
powershell:
-
Go to Start => All Programs => Microsoft
SharePoint 2010 Products => SharePoint 2010 Management Shell.
-
Run as an administrator.
-
Run the following script.
$site = get-SPSite("http://serverName:22222/sites/Test/")
$web = $site.RootWeb
$list = $web.Lists["Shared Documents"]
foreach ($item in $list.Items)
{
if ($item.DisplayName.ToString() -eq "New")
{
$holds = [Microsoft.Office.RecordsManagement.Holds.Hold]::GetHolds($item)
foreach ($holdItem in $holds)
{
write-host -f green $holdItem.Title
}
}
}