.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Check whether the item is in hold in SharePoint 2010 using powershell

Posted By:Vijai Anand. R       Posted Date: May 14, 2011    Points: 40    Category: SharePoint    URL: http://www.dotnetspark.com  

In this we will be seeing whether the list item is in hold in SharePoint 2010 using powershell.
 

n Shared Documents I have a document "New", here I am going to check whether the item is in hold or not 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")
 {
   if([Microsoft.Office.RecordsManagement.Holds.Hold]::IsItemOnHold($item))
   {
      write-host -f green $item.DisplayName "is on hold"
   }
 }
}



     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend