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

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.

share|improve this question
    
Does your feature use RunWithElevatedPrivileges at all? How are you getting the current user object? –  TZHX Dec 5 '12 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. –  DeeMac Dec 5 '12 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 '12 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. –  DeeMac Dec 5 '12 at 11:24
    
Also - I've set file.Item["Created By"] aswell, but the problem still persists. –  DeeMac Dec 5 '12 at 11:26
show 1 more comment

3 Answers

When you add user in site, u mark as System account so it display as system account

share|improve this answer
    
What do you mean 'mark'? Thanks for your reply. –  DeeMac Dec 5 '12 at 9:32
add comment

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

share|improve this answer
add comment

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

share|improve this answer
add comment

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.