0

I have implemented a feature in my solution where by the current user's Name is assigned to a field. With certain users - this appears as 'System Account'. Is it possible that if somebody is the site collection admin., for example, this will happen? I can't work out why.

6
  • Does your feature use RunWithElevatedPrivileges at all? How are you getting the current user object?
    – TZHX
    Dec 5, 2012 at 11:03
  • @TZHX - I am indeed. I've just done some reading around and now appreciate that using elevate privleges to update an item sets it as modified by and authored by the system account. I need both to be the current user. Dec 5, 2012 at 11:20
  • Indeed. It's a common problem. What sort of context is the code running in (EventReceiver, etc.)? Some make it easier to work around than others.
    – TZHX
    Dec 5, 2012 at 11:23
  • It's all functionality that supports a customised 'document upload' feature. I'm successfully setting file.Item["Author"] and file.Item["Modified By"] but for some reason (when retrieving the newly uploaded document) File.Item.Author is still System Account!? Thanks a lot for your reply. Dec 5, 2012 at 11:24
  • Also - I've set file.Item["Created By"] aswell, but the problem still persists. Dec 5, 2012 at 11:26

2 Answers 2

1

CHeck the Central admin and go to Web application and see the user policy from ribbon and see if some account is added as to be run under system account

0

Trying using properties.UserLoginName rather than geting the user name from the context objects (as the context is running under elevated credentials).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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