Here's an odd one:
I have a content type derived from SPFolder, that I am creating through code. As part of the creation process, I am trying to set the "Created By" information to be the user who should be attributed as the creator of the folder. I'm using the following code:
// after setting some other field values: SPFieldUserValue userValue = new SPFieldUserValue(web, user.ID, user.LoginName); folderItem[SPBuiltInFieldId.Author] = userValue; folderItem[SPBuiltInFieldId.Created_x0020_By] = userValue; folderItem.SystemUpdate(false);
Now, if I go in with Powershell or SharePoint Manager, I can see that in the folder's properties and in the folder's item's properties, the value of
display_urn:schemas-microsoft-com:office:office#Author is the correct user value, and the only place I can find
SHAREPOINT\system is in
However, when I go and view properties of the folder (through the SharePoint UI), in the view form, the System Account is listed for both created by and modified by. And, if I add "Created By" to the list view, it's all System Account there too.
So where is SharePoint pulling that from? What other mystery field do I need to set to get my user as the Created By person?