Tuesday, July 6, 2010

SharePoint ReadOnly Columns

Have you ever thought of changing SharePoint read-only columns? The created by, modified by columns, which always seem to be impossible to change, below is the code on how to change those columns:

SPList _pList = impersonatedWeb.Lists[ListName];

_pList.Fields["Created By"].ReadOnlyField = false;

//Update the relevant list item

Once you have updated the relevant list items you have to change the field back to Read Only mode, as shown below:

_pList.Fields["Created By"].ReadOnlyField = true;

No comments:

Post a Comment