Skip to content
This repository was archived by the owner on Jul 31, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions WebAppGraphAPI/Models/UserProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,38 @@
namespace WebAppGraphAPI.Models
{
public class UserProfile
{
public string DisplayName { get; set; }
public string GivenName { get; set; }
public string Surname { get; set; }
{
public string ObjectType { get; set; }
public List<object> AssignedLicenses { get; set; }
public List<object> AssignedPlans { get; set; }
public object City { get; set; }
public object Country { get; set; }
public object Department { get; set; }
public object DirSyncEnabled { get; set; }
public string DisplayName { get; set; }
public object FacsimileTelephoneNumber { get; set; }
public string GivenName { get; set; }
public object ImmutableId { get; set; }
public object JobTitle { get; set; }
public object LastDirSyncTime { get; set; }
public object Mail { get; set; }
public string MailNickname { get; set; }
public object Mobile { get; set; }
public List<string> OtherMails { get; set; }
public string PasswordPolicies { get; set; }
public object PasswordProfile { get; set; }
public object PhysicalDeliveryOfficeName { get; set; }
public object PostalCode { get; set; }
public object PreferredLanguage { get; set; }
public List<object> ProvisionedPlans { get; set; }
public List<object> ProvisioningErrors { get; set; }
public List<object> ProxyAddresses { get; set; }
public object State { get; set; }
public object StreetAddress { get; set; }
public string Surname { get; set; }
public object TelephoneNumber { get; set; }
public object UsageLocation { get; set; }
public string UserPrincipalName { get; set; }
public string UserType { get; set; }
}
}
84 changes: 52 additions & 32 deletions WebAppGraphAPI/Views/UserProfile/Index.cshtml
Original file line number Diff line number Diff line change
@@ -1,32 +1,52 @@
@model WebAppGraphAPI.Models.UserProfile
@{
ViewBag.Title = "User Profile";
}

<h2>@ViewBag.Title.</h2>

<table class="table table-bordered table-striped">
<tr>
<td>Display Name</td>
<td>@Model.DisplayName</td>
</tr>
<tr>
<td>First Name</td>
<td>@Model.GivenName</td>
</tr>
<tr>
<td>Last Name</td>
<td>@Model.Surname</td>
</tr>
</table>

@if (ViewBag.ErrorMessage == "AuthorizationRequired")
{
<p>You have to sign-in to see your profile. Click @Html.ActionLink("here", "Index", "UserProfile", new { reauth = true }, null) to sign-in.</p>
}

@if (ViewBag.ErrorMessage == "UnexpectedError")
{
<p>An unexpected error occurred while retrieving your profile. Please try again. You may need to sign-in.</p>
}

@using System.Collections
@model WebAppGraphAPI.Models.UserProfile
@{
ViewBag.Title = "User Profile";
}
<h2>@ViewBag.Title.</h2>

<table class="table table-bordered table-striped">
@{
var type = Model.GetType();
var properties = type.GetProperties();
var collections = new List<Type>() { typeof(IEnumerable<>), typeof(IEnumerable) };

foreach (var property in properties)
{
<tr>
<td>@property.Name</td>
<td>
@{
if (property.PropertyType != typeof(string) && property.PropertyType.GetInterfaces().Any(i => collections.Any(c => i == c)))
{
var list = (IList)property.GetValue(Model, null);
if (list != null)
{
foreach (var value in list)
{
@value<br />
}
}

}
else
{
@property.GetValue(Model, null)
}
}
</td>

</tr>
}

}
</table>

@if (ViewBag.ErrorMessage == "AuthorizationRequired")
{
<p>You have to sign-in to see your profile. Click @Html.ActionLink("here", "Index", "UserProfile", new { reauth = true }, null) to sign-in.</p>
}
@if (ViewBag.ErrorMessage == "UnexpectedError")
{
<p>An unexpected error occurred while retrieving your profile. Please try again. You may need to sign-in.</p>
}