Cal*_*v1n 37 .net c# exchange-server
我想知道用户的电子邮件地址(假设她在典型的Windows办公网络中).这是在C#应用程序中.也许是有效的东西
CurrentUser.EmailAddress;
Run Code Online (Sandbox Code Playgroud)
Col*_*nic 118
System.DirectoryServices.AccountManagement然后参考
using System.DirectoryServices.AccountManagement;
UserPrincipal.Current.EmailAddress
Run Code Online (Sandbox Code Playgroud)
或者超时:
var task = Task.Run(() => UserPrincipal.Current.EmailAddress);
if (task.Wait(TimeSpan.FromSeconds(1)))
return task.Result;
Run Code Online (Sandbox Code Playgroud)
小智 5
如果您位于Windows域后面,则可以始终从Active Directory中获取其电子邮件地址.
这是一个例子:http://lozanotek.com/blog/articles/149.aspx
| 归档时间: |
|
| 查看次数: |
37428 次 |
| 最近记录: |