This repository was archived by the owner on Jan 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 648
Expand file tree
/
Copy pathGetOffice365Services.cs
More file actions
36 lines (34 loc) · 1.45 KB
/
GetOffice365Services.cs
File metadata and controls
36 lines (34 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#if !ONPREMISES
using System.Collections.Generic;
using System.Management.Automation;
using OfficeDevPnP.Core.Framework.Graph;
using PnP.PowerShell.CmdletHelpAttributes;
using PnP.PowerShell.Commands.Base;
using PnP.PowerShell.Commands.Model;
using PnP.PowerShell.Commands.Utilities.REST;
namespace PnP.PowerShell.Commands.ManagementApi
{
[Cmdlet(VerbsCommon.Get, "PnPOffice365Services")]
[CmdletHelp(
"Gets the services available in Office 365 from the Office 365 Management API",
Category = CmdletHelpCategory.ManagementApi,
OutputTypeLink = "https://docs.microsoft.com/office/office-365-management-api/office-365-service-communications-api-reference#get-services",
SupportedPlatform = CmdletSupportedPlatform.Online)]
[CmdletExample(
Code = "PS:> Get-PnPOffice365Services",
Remarks = "Retrieves the current services available in Office 365",
SortOrder = 1)]
[CmdletOfficeManagementApiPermission(OfficeManagementApiPermission.ServiceHealth_Read)]
public class GetOffice365Services : PnPOfficeManagementApiCmdlet
{
protected override void ExecuteCmdlet()
{
var collection = GraphHelper.GetAsync<GraphCollection<ManagementApiService>>(HttpClient, $"{ApiRootUrl}ServiceComms/Services", AccessToken, false).GetAwaiter().GetResult();
if(collection != null)
{
WriteObject(collection.Items, true);
}
}
}
}
#endif