Cannot Undeclare Record in SharePoint

Using SharePoint Records Management, I declared a document as a record.  Then I tried to undeclare the document as a record.  For some reason SharePoint wouldn’t not undeclare the document.

Using PowerShell, you can force the undeclare action.

#Load the sharepoint snapin
$SPWeb = Get-SPWeb "http://sharepointed.com/sites/taco" 
  
$SPList = $SPWeb.Lists["Taco Recipes"]   
$SPItem = $SPList.GetItemById("75")     

#new code to remove hold first    
$SPItem.Properties.Remove("ecm_ItemLockHolders")
$SPItem.File.Properties.Remove("ecm_ItemLockHolders")   
$SPItem.SystemUpdate()    

#undeclare the record
[Microsoft.Office.RecordsManagement.RecordsRepository.Records]::UndeclareItemAsRecord($SPItem)

 

Doing this will remove the lock from the document.

Leave a Reply

Your email address will not be published. Required fields are marked *