SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my situation, I have records being added to a record center that are immediately declared as a record. There are some fields that are associated with these list items that I need to be able to update from an event receiver and from a workflow.

Short of un-declaring & re-declaring the record, what alternatives do I have to updates these fields for each of the list items? Where else could I store these fields?

share|improve this question
up vote 1 down vote accepted

The SharePoint object model provides a supported way of updating a record without unlocking it. There's a guide here that describes some of the relevant information. I was able to get a working example (excuse some of the 'basic' naming) in an ItemUpdated event receiver.

    using (SPSite site = new SPSite(properties.SiteId))
        using (SPWeb web2 = site.OpenWeb(properties.Web.ID))
            SPListItem item = web2.Lists.GetList(properties.List.ID, false).GetItemById(properties.ListItemId);

            Records.BypassLocks(item, delegate(SPListItem newItem)
                newItem["Title"] = "Hello from code";
                newItem.Audit.WriteAuditEvent(SPAuditEventType.Custom, SPAuditEventSource.ObjectModel.ToString(), "<Data>Audit text</Data>");


As usual with SPSecurity.RunWithElevatedPrivileges, you must create new SPSite and SPWeb objects, as well as a new SPListItem object otherwise you end up with the error Attempted to perform an unauthorized operation.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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