I am trying to undeclare a record but it won't just work for some documents while it works for most of the document. It will say this item cannot be undeclared as a record because it is checked out. When I try to discard the checked out, it says the item cannot be updated because it is locked as read only

I tried manually and even using PowerShell to discard the checked out/checkin the document/undeclare the record, but nothing worked.

I searched all over the internet and all the solutions provided are not working in this case. I tried even these: http://weblogs.asp.net/peterbrunone/read-only-lock-on-a-sharepoint-site-collection-or-why-can-t-i-edit-anymore


Nothing helped me undeclare the document. Please help me undeclare the records. What can be the reason? Why this is happening with only few documents and not all?


I had the same problem. It occured, when a user downloaded a Office-Document in Record-State, changed it and uploaded it again. I guess the reason is that, because some of the metadata fields are stored in the properties of the office document itself, while properties are not. And if the document is uploaded again, the metadatafields are imported again, but the properties set are missing. And the "Records"-function relies on a summary of metadatafields and properties. So Sharepoint believes the document is a record (because of the metada-fields), but cannot unlock it because of the missing properties.

However: I made some code, which was able to correct this

                if (Records.IsRecord(currentItem))
                //necessary, because obviously the replacement file has been downloaded from sharepoint in Record-State

                var siteId = currentItem.Web.Site.ID;
                var webId = currentItem.Web.ID;
                var url = currentItem.File.ServerRelativeUrl;
                    using (var site = new SPSite(siteId))
                    using (var web = site.OpenWeb(webId))
                        var elevatedItem = web.GetListItem(url);
                        Records.BypassLocks(elevatedItem, delegate(SPListItem item)
                            if (item.Fields.Contains(Microsoft.SharePoint.Publishing.FieldId.HoldRecordStatus))
                                item[Microsoft.SharePoint.Publishing.FieldId.DeclaredRecord] = null;
                                item[Microsoft.SharePoint.Publishing.FieldId.HoldRecordStatus] = null;
                                if (item.Fields.Contains(Microsoft.SharePoint.Publishing.FieldId.IsLocked))
                                    item[Microsoft.SharePoint.Publishing.FieldId.IsLocked] = null;
                                item.Properties["ecm_ItemLockHolders"] = null;
                                item[Microsoft.SharePoint.Publishing.FieldId.IconOverlay] = null;
                currentItem = currentItem.Web.GetListItem(currentItem.File.ServerRelativeUrl);

In my case that code is executed when a new document is uploaed. It checks if it is in Record-State, (which can´t really be for new Document). You could modify it to your needs. In Fact the code bypasses the lock (because unlock does not work) and cleans the necessary metadafields by itself (in fact removing a lock manually).

|improve this answer|||||
  • Thanks Leopold. But the problem now is that my team doesn't have any control over the application code. We are supposed to fix this manually or using powershell scripts. Is this possible using Powershell? Edit: I have tried to remove the hold and undreclare record using Powershell which didn't work. – kaz Jun 24 '16 at 10:35

$checkout = {

[Microsoft.Office.RecordsManagement.RecordsRepository.Records]::bypasslocks($item, $checkout)


This code helped me bypass the lock and undeclare it :)

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.