In this article we will be seeing how to get all holds lists from the SharePoint site using object model.
I have created 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 created the feature you could be able to see the following options (Site Actions => Site Settings => Hold and eDiscovery).
We will be seeing how to get all holds lists for the SharePoint site. We will be usingHold.GetAllHoldsLists Method to get all holds list.
Gets all holds lists in a specified 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.
Hit F5, you will be getting all holds lists for the SharePoint site.