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.
Hold.GetHoldReportsList Method
Gets a list of items currently on hold for the specified SharePoint site.
- Namespace:
Microsoft.Office.RecordsManagement.Holds
- Assembly: Microsoft.Office.Policy
(in Microsoft.Office.Policy.dll)
Steps Involved:
- Open Visual Studio 2010.
- Create a new console application.
- Add the following references.
-
Microsoft.Office.Policy.dll
- Microsoft.SharePoint.dll
- Add the following namespaces.
-
Using Microsoft.Sharepont;
- Using Microsoft.Office.RecordsManagement.Holds;
- Replace the code with the following.
- Build the solution.
- Hit F5.
- Output: