-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6835795
commit 1c03031
Showing
10 changed files
with
114 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,58 @@ | ||
@page | ||
@model hack_together_groups_manager.Pages.GroupDetailsModel | ||
@{ | ||
ViewData["Title"] = "M365 Group Details"; | ||
} | ||
|
||
<style> | ||
body { | ||
padding: 20px 0; | ||
background: #f2f5f8; | ||
} | ||
</style> | ||
|
||
<div class="text-left"> | ||
<h3 class="display-8">Group Details: </h3> | ||
|
||
<table> | ||
<tr> | ||
<td>Display Name:</td> | ||
<td>@Model.M365GroupDetails.DisplayName</td> | ||
</tr> | ||
<tr> | ||
<td>Description:</td> | ||
<td>@Model.M365GroupDetails.Description</td> | ||
</tr> | ||
<tr> | ||
<td>Visibility:</td> | ||
<td>@Model.M365GroupDetails.Visibility</td> | ||
</tr> | ||
</table> | ||
|
||
<p></p> | ||
<div>Owners:</div> | ||
<table class="table table-striped border"> | ||
@foreach (var owner in Model.M365GroupDetails.Owners) | ||
{ | ||
<tr> | ||
<td> | ||
@Html.DisplayFor(m => owner) | ||
</td> | ||
</tr> | ||
} | ||
</table> | ||
|
||
<p></p> | ||
<div>Members:</div> | ||
<table class="table table-striped border"> | ||
@foreach (var member in Model.M365GroupDetails.Members) | ||
{ | ||
<tr> | ||
<td> | ||
@Html.DisplayFor(m => member) | ||
</td> | ||
</tr> | ||
} | ||
</table> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,62 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
using Microsoft.AspNetCore.Mvc.Rendering; | ||
using Microsoft.Graph; | ||
using System.Diagnostics.Metrics; | ||
|
||
namespace hack_together_groups_manager.Pages | ||
{ | ||
public class GroupDetailsModel : PageModel | ||
{ | ||
public void OnGet() | ||
private readonly ILogger<IndexModel> _logger; | ||
private readonly GraphServiceClient _graphServiceClient; | ||
public Models.M365Group M365GroupDetails { get; set; } | ||
|
||
public GroupDetailsModel(ILogger<IndexModel> logger, GraphServiceClient graphServiceClient) | ||
{ | ||
_logger = logger; | ||
_graphServiceClient = graphServiceClient; | ||
} | ||
|
||
public async Task OnGetAsync() | ||
{ | ||
string groupId = HttpContext.Request.Query["groupId"]; | ||
var groupInfo = new Models.M365Group(); | ||
|
||
if (groupId != null) | ||
{ | ||
var resultGroupInfo = await this._graphServiceClient.Groups[groupId].Request().GetAsync(); | ||
if (resultGroupInfo != null) | ||
{ | ||
var group = resultGroupInfo as Microsoft.Graph.Group; | ||
|
||
groupInfo.Description = group.Description; | ||
groupInfo.DisplayName = group.DisplayName; | ||
groupInfo.Visibility = group.Visibility; | ||
} | ||
|
||
var resultMembersInfo = await this._graphServiceClient.Groups[groupId].Members.Request().GetAsync(); | ||
if (resultMembersInfo != null) | ||
{ | ||
groupInfo.Members = new List<string>(); | ||
foreach (var member in resultMembersInfo) | ||
{ | ||
groupInfo.Members.Add((member as Microsoft.Graph.User).UserPrincipalName); | ||
} | ||
} | ||
|
||
var resultOwnersInfo = await this._graphServiceClient.Groups[groupId].Owners.Request().GetAsync(); | ||
if (resultOwnersInfo != null) | ||
{ | ||
groupInfo.Owners = new List<string>(); | ||
foreach (var owner in resultOwnersInfo) | ||
{ | ||
groupInfo.Owners.Add((owner as Microsoft.Graph.User).UserPrincipalName); | ||
} | ||
} | ||
} | ||
|
||
M365GroupDetails = groupInfo; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.