Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a piece of code which gets the email address of a SPUser object. The email property is empty. Where I can fill the email address of this user? Is it in SharePoint or somewhere in AD? I dont have a sync connection to AD!

SPFieldUser userField = (SPFieldUser)currentItem.Fields.GetField(Constants.Fields.FIELD_CLIENT);
            SPFieldUserValue fieldValue = (SPFieldUserValue)userField.GetFieldValue(Convert.ToString(currentItem[Constants.Fields.FIELD_CLIENT]));
            SPUser assignedToUser = fieldValue.User;


string clientEmail = assignedToUser.Email;

// dosomething
share|improve this question

1 Answer

You will need to actually request the user profile for that user so you can read all the properties for that user (including email). This question has some samples of how to do that in code: How to get user profile property value when privacy for property set to "Private" (only me)

share|improve this answer

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.