In this article we will be seeing how to get all the items from the Hold Reports list using SharePoint object model.
I have a SharePoint site and I have activated the Site feature (Go to Site Actions => Site Settings => Site Actions => manage Site features) "Hold and eDiscovery". Once you have the feature activated you could be able to see the new custom group as shown in the following
Go to Site Actions => Site Settings => Hold and eDiscovery
I have two items in the "Hold Reports" as shown in the following.
We are going to retrieve these items using object model.
We will be using Hold.GetHoldReportsList Method to get a list of items currently on hold for the specified SharePoint site.
Gets a list of items currently on hold for the specified SharePoint site.
Assembly: Microsoft.Office.Policy (in Microsoft.Office.Policy.dll)
Open Visual Studio 2010.
Create a new console application.
Add the following references.
Add the following namespaces.
Replace the code with the following.
Build the solution.