Вопрос

I am writing a Webpart for an on-premise SharePoint 2013. I need to persist data to a list with elevated privileges but still need to be able to keep track who changed and added items.

When I view the version history I can only see the System Account, because of of the elevated privileges all changes are done with this account.

Is there a way where I can get a privileged web but still keep the User Information of the actual user?

Это было полезно?

Решение

You can update the Modified, Created, Author and Editor with the actual user and time and then call SPListItem.SystemUpdate instead of SPListItem.Update. This way time stamps and actual user information will be preserved.

SPListItem.SystemUpdate Updates the database with changes that are made to the list item without changing the Modified or Modified By fields.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top