惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Schneier on Security
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
C
Cybersecurity and Infrastructure Security Agency CISA
Engineering at Meta
Engineering at Meta
Google DeepMind News
Google DeepMind News
酷 壳 – CoolShell
酷 壳 – CoolShell
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
T
Threat Research - Cisco Blogs
C
Cisco Blogs
Recent Announcements
Recent Announcements
S
Securelist
N
Netflix TechBlog - Medium
The Register - Security
The Register - Security
P
Privacy & Cybersecurity Law Blog
宝玉的分享
宝玉的分享
D
Darknet – Hacking Tools, Hacker News & Cyber Security
L
LINUX DO - 热门话题
T
Tor Project blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
月光博客
月光博客
AWS News Blog
AWS News Blog
P
Proofpoint News Feed
博客园 - 司徒正美
L
LINUX DO - 最新话题
Stack Overflow Blog
Stack Overflow Blog
博客园 - 聂微东
H
Help Net Security
Spread Privacy
Spread Privacy
PCI Perspectives
PCI Perspectives
Project Zero
Project Zero
I
Intezer
T
The Blog of Author Tim Ferriss
有赞技术团队
有赞技术团队
The Last Watchdog
The Last Watchdog
C
Check Point Blog
Blog — PlanetScale
Blog — PlanetScale
B
Blog RSS Feed
MyScale Blog
MyScale Blog
V
Vulnerabilities – Threatpost
Recorded Future
Recorded Future
T
Tenable Blog
Jina AI
Jina AI
D
DataBreaches.Net
阮一峰的网络日志
阮一峰的网络日志

博客园 - 害羞的狮子王

无责任Windows Azure SDK .NET开发入门篇三[使用Azure AD 管理用户信息--3.5 Delete删除用户] 无责任Windows Azure SDK .NET开发入门篇三[使用Azure AD 管理用户信息--3.4 Edit修改用户信息] 无责任Windows Azure SDK .NET开发入门篇三[使用Azure AD 管理用户信息--3.2 Create创建用户] 无责任Windows Azure SDK .NET开发入门篇三[使用Azure AD 管理用户信息--3.1 Index用户列表] 无责任Windows Azure SDK .NET开发入门篇三[使用Azure AD 管理用户信息] 无责任Windows Azure SDK .NET开发入门篇二[使用Azure AD 进行身份验证-2.2身份验证开发] 无责任Windows Azure SDK .NET开发入门篇二[使用Azure AD 进行身份验证--2.1使用Azure AD需要了解几个概念] 无责任Windows Azure SDK .NET开发入门篇二[使用Azure AD 进行身份验证] 无责任Windows Azure SDK .NET开发入门篇一[Windows Azure开发前准备工作] 建立小型开发团队的工作协作:翻译工作 建立小型开发团队的工作协作:讨论区 建立小型开发团队的工作协作:BugList 建立小型开发团队的工作协作:任务日历 建立小型开发团队的工作协作:简单的文档管理 建立小型开发团队的工作协作:管理调查和投票 建立小型开发团队的工作协作:管理链接 建立小型开发团队的工作协作:总览效果图 感谢微软BPOS4China技术支持组 远程为服务器安装Windows 2008 Server
无责任Windows Azure SDK .NET开发入门篇三[使用Azure AD 管理用户信息--3.3 Details用户详细信息]
害羞的狮子王 · 2015-08-10 · via 博客园 - 害羞的狮子王

3.3 Details用户详细信息

用户详细信息是通过objectId获取。代码如下

public async Task<ActionResult> Details(string objectId)
{
    try
    {
        ActiveDirectoryClient client = AuthenticationHelper.GetActiveDirectoryClient();
        var user = (User)await client.Users.GetByObjectId(objectId).ExecuteAsync();
        return View(user);
    }
    catch (Exception e)
    {
        if (e.Message == "Authorization Required.")
        {
            HttpContext.GetOwinContext().Authentication.Challenge(OpenIdConnectAuthenticationDefaults.AuthenticationType);
        }
        return View();
    }
}

对应的View代码如下

@model Microsoft.Azure.ActiveDirectory.GraphClient.User

@{
    ViewBag.Title = "UserDetails";
}

<h2>User Details</h2>

<div class="form-horizontal">
    <div class="form-group">
        @Html.LabelFor(model => model.UserPrincipalName, "用户名(全名)", new { @class = "col-sm-2 control-label" })
        <div class="col-sm-10">
            @Html.DisplayFor(model => model.UserPrincipalName)
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(model => model.MailNickname, "别名", new { @class = "col-sm-2 control-label" })
        <div class="col-sm-10">
            @Html.DisplayFor(model => model.MailNickname)
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(model => model.City, "城市", new { @class = "col-sm-2 control-label" })
        <div class="col-sm-10">
            @Html.DisplayFor(model => model.City)
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(model => model.Country, "国家或地区", new { @class = "col-sm-2 control-label" })
        <div class="col-sm-10">
            @Html.DisplayFor(model => model.Country)
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(model => model.Department, "部门", new { @class = "col-sm-2 control-label" })
        <div class="col-sm-10">
            @Html.DisplayFor(model => model.Department)
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(model => model.DisplayName, "显示名称", new { @class = "col-sm-2 control-label" })
        <div class="col-sm-10">
            @Html.DisplayFor(model => model.DisplayName)
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(model => model.PhysicalDeliveryOfficeName, "办公室号码", new { @class = "col-sm-2 control-label" })
        <div class="col-sm-10">
            @Html.DisplayFor(model => model.PhysicalDeliveryOfficeName)
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(model => model.TelephoneNumber, "办公电话", new { @class = "col-sm-2 control-label" })
        <div class="col-sm-10">
            @Html.DisplayFor(model => model.TelephoneNumber)
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(model => model.GivenName, "名字", new { @class = "col-sm-2 control-label" })
        <div class="col-sm-10">
            @Html.DisplayFor(model => model.GivenName)
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(model => model.JobTitle, "职务", new { @class = "col-sm-2 control-label" })
        <div class="col-sm-10">
            @Html.DisplayFor(model => model.JobTitle)
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(model => model.PostalCode, "邮政编码", new { @class = "col-sm-2 control-label" })
        <div class="col-sm-10">
            @Html.DisplayFor(model => model.PostalCode)
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(model => model.State, "省/自治区/直辖市", new { @class = "col-sm-2 control-label" })
        <div class="col-sm-10">
            @Html.DisplayFor(model => model.State)
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(model => model.StreetAddress, "街道地址", new { @class = "col-sm-2 control-label" })
        <div class="col-sm-10">
            @Html.DisplayFor(model => model.StreetAddress)
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(model => model.Surname, "姓氏", new { @class = "col-sm-2 control-label" })
        <div class="col-sm-10">
            @Html.DisplayFor(model => model.Surname)
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(model => model.UserType, new { @class = "col-sm-2 control-label" })
        <div class="col-sm-10">
            @Html.DisplayFor(model => model.UserType)
        </div>
    </div>
</div>

<table>
    <tbody>
        <tr>
            <td>
                @Html.ActionLink("Edit", "Edit", new { objectId = Model.ObjectId }, new { @class = "btn btn-primary" })
            </td>
            <td>
                @Html.ActionLink("Delete", "Delete", new { objectId = Model.ObjectId }, new { @class = "btn btn-warning" })
            </td>
            <td>
                @Html.ActionLink("List", "Index", null, new { @class = "btn btn-info" })
            </td>
        </tr>
    </tbody>
</table>