Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

We changed domains and I need to updated the User fields in all lists and libraries to reflect the new domain accounts. (I know that stsadm.exe -o migrateuser will mostly handle this but since it disables any existing new accounts it does not handle the list items and documents that are already pointing to the new domain account.)

Anyways, my problem is updating the "Editor" or "Modified By" field. If I use the UpdateOverwriteVersion() method the field is properly updated but with the side effect of the "modified timestamp" being changed. If I use the SystemUpdate(False) method, the updated field is ignored and does not reflect the new account.

What can I do to get the field to update without changing the associated timestamp?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

After some further research (no help) and experimenting (helpful) I figured out what needs to be done. It seems that two things need to be done in order to update the "Modified By" field while leaving the "Modified" (timestamp) field alone.

Set the "Modified" field value to itself

Use the UpdateOverwriteVersion() method

Dim items As SPListItemCollection
items = some_list.Items

For Each i As SPListItem in items
   Dim activeUser As SPFieldUserValue = New SPFieldUserValue(i.Web, 27)    ' some user

   item.Item("Editor") = activeUser                       ' set to new user
   item.Item("Modified") = item.Item("Modified")          ' set to same value

   item.UpdateOverwriteVersion()
Next

Obviously, internally, setting the value of the Modified field to itself is marking the field as "dirty" and to indicating that it should be used instead of the current date/time.

share|improve this answer
    
Didn't know that UpdateOverwriteVerion existed, works the same in c#. –  George Norberg Jun 2 at 11:01

Your Answer

 
discard

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.