2011-11-17 1 views

답변

2

예,이 같은합니다 (email property 보유)을 SPUser 개체에 액세스 할 수 있습니다

var accountName = peoplePicker.Accounts[0]; 

//this will create a new account on SharePoint if a user with the given accountName does not exist 
var user = web.EnsureUser(accountName); 

lblEmail = user.Email; 

peoplePicker 분명 사람들의 선택 컨트롤은을, 웹은 당신이 할 수있는 (당신이에 현재 웹의 인스턴스 SPContext.Current.Web의 웹 사용). 당신은 사람들 선택기에서 사용자 이름을 입력하고 Enter를 쳤을 때 화재는, 그러나 당신은 당신이를 Page_Load을 통해 처리 할 수있는 일반적인 다시 게시를 발생 사실에 AutoPostBack 속성을 설정할 수있는 특정 이벤트가 없다

...

다음으로

는 마크 업에 PeoplePicker를 정의

<SharePoint:PeopleEditor AutoPostBack="true" ID="peUser" runat="server" /> 

를를 Page_Load에서 당신은 단순히 사람들 선택기 하나를 보유 (이상 따라 다름) 계정 속성 계정 여부를 확인하고 다음 작업을 수행 ...

당신이 원하는 모든 이메일 주소 인 경우이

+0

덕분에, 다른 레이블에. 나는 일단 사용자가 그것이 일어나면 안되면 그것을 처리 할 이벤트가 없다. – TinTin

+0

내 대답 – int32

+0

를 편집 한 경우 (peopleEditor.IsValid)에 대한 { 이 경우 (Page.IsPostBack) { INT (I = 0; I TinTin

0

도움이되기를 바랍니다이 작동합니다 : i는 사용자가 이메일을 채워야 보장이 code.once를 작성해야 할

if (pectrl.ResolvedEntities.Count > 0) 
{ 
    PickerEntity pe = (PickerEntity)pectrl.ResolvedEntities[0]; 
    string email = pe.EntityData[PeopleEditorEntityDataKeys.Email].ToString(); 
} 
관련 문제