Need some script helping - M365 API

This page summarizes the projects mentioned and recommended in the original post on /r/PowerShell

SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
surveyjs.io
featured
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
  • msgraph-sdk-javascript

    Microsoft Graph client library for JavaScript

  • $ApplicationID = 'applicationid from my app registration with relevant permissions' $ApplicationKey = 'application secret' $tenantid = 'obviously the tenant id' $URI = 'teams webhook url' $Minutes = '2' $ExchangeOnline = 'yes' $MicrosoftForms = '' $MicrosoftIntune = '' $MicrosoftKaizala = '' $SkypeforBusiness = '' $MicrosoftDefenderATP = '' $MicrosoftFlow = '' $FlowinMicrosoft365 = '' $MicrosoftTeams = 'yes' $MobileDeviceManagementforOffice365 = '' $OfficeClientApplications = '' $Officefortheweb = '' $OneDriveforBusiness = 'yes' $IdentityService = '' $Office365Portal = 'yes' $OfficeSubscription = '' $Planner = '' $PowerApps = '' $PowerAppsinMicrosoft365 = '' $PowerBI = '' $AzureInformationProtection = '' $SharePointOnline = 'yes' $MicrosoftStaffHub = '' $YammerEnterprise = '' $Microsoft365Suite = '' $Incident = 'yes' $Advisory = '' $ServicesArray = @() if($ExchangeOnline){$ServicesArray += '$_.service -eq "Exchange Online"'} if($MicrosoftForms){$ServicesArray += '$_.service -eq "Microsoft Forms"'} if($MicrosoftIntune){$ServicesArray += '$_.service -eq "Microsoft Intune"'} if($MicrosoftKaizala){$ServicesArray += '$_.service -eq "Microsoft Kaizala"'} if($SkypeforBusiness){$ServicesArray += '$_.service -eq "Skype for Business"'} if($MicrosoftDefenderATP){$ServicesArray += '$_.service -eq "Microsoft Defender ATP"'} if($MicrosoftFlow){$ServicesArray += '$_.service -eq "Microsoft Flow"'} if($FlowinMicrosoft365){$ServicesArray += '$_.service -eq "Flow in Microsoft 365"'} if($MicrosoftTeams){$ServicesArray += '$_.service -eq "Microsoft Teams"'} if($MobileDeviceManagementforOffice365){$ServicesArray += '$_.service -eq "Mobile Device Management for Office 365"'} if($OfficeClientApplications){$ServicesArray += '$_.service -eq "Office Client Applications"'} if($Officefortheweb){$ServicesArray += '$_.service -eq "Office for the web"'} if($OneDriveforBusiness){$ServicesArray += '$_.service -eq "OneDrive for Business"'} if($IdentityService){$ServicesArray += '$_.service -eq "Identity Service"'} if($Office365Portal){$ServicesArray += '$_.service -eq "Office 365 Portal"'} if($OfficeSubscription){$ServicesArray += '$_.service -eq "Office Subscription"'} if($Planner){$ServicesArray += '$_.service -eq "Planner"'} if($PowerApps){$ServicesArray += '$_.service -eq "PowerApps"'} if($PowerAppsinMicrosoft365){$ServicesArray += '$_.service -eq "PowerApps in Microsoft 365"'} if($PowerBI){$ServicesArray += '$_.service -eq "Power BI"'} if($AzureInformationProtection){$ServicesArray += '$_.service -eq "Azure Information Protection"'} if($SharepointOnline){$ServicesArray += '$_.service -eq "Sharepoint Online"'} if($MicrosoftStaffHub){$ServicesArray += '$_.service -eq "Microsoft StaffHub"'} if($YammerEnterprise){$ServicesArray += '$_.service -eq "Yammer Enterprise"'} if($Microsoft365Suite){$ServicesArray += '$_.service -eq "Microsoft 365 Suite"'} $ServicesString = $ServicesArray -Join " -or " $ClassificationArray = @() if($Incident){$ClassificationArray += '$_.Classification -eq "incident"'} if($Advisory){$ClassificationArray += '$_.Classification -eq "advisory"'} $ClassificationString = $ClassificationArray -Join " -or " $body = @{ grant_type="client_credentials"; resource="https://graph.microsoft.com"; client_id=$ApplicationID; client_secret=$ApplicationKey; earliest_time="-$($Minutes)m@s"} $oauth = Invoke-RestMethod -Method Post -Uri "https://login.microsoftonline.com/$tenantid/oauth2/token?api-version=1.0" -Body $body $headerParams = @{'Authorization'="$($oauth.token_type) $($oauth.access_token)"} $messages = (Invoke-RestMethod -Uri "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/issues" -Headers $headerParams -Method Get) $incidents = $messages.Value | Where-Object ([scriptblock]::Create($ClassificationString)) | Where-Object ([scriptblock]::Create($ServicesString)) $Now = Get-Date ForEach ($inc in $incidents){ # Add updates posted last $Minutes If (($Now - [datetime]$inc.lastModifiedDateTime).TotalMinutes -le $Minutes) { # Set the color line of the card according to the Classification of the event, or if it has ended if ($inc.Classification -eq "incident" -and $inc.EndTime -eq $null) { $color = "ff0000" # Red } else { if ($inc.EndTime -ne $null) { $color = "00cc00" # Green } else { $color = "ffff00" # Yellow } } $Message = $inc.posts.description.content[$inc.Messages.Count-1] | ConvertTo-Json $Payload = @" { "@context": "https://schema.org/extensions", "@type": "MessageCard", "potentialAction": [ { "@type": "OpenUri", "name": "Post INC document", "targets": [ { "os": "default", "uri": "$($inc.PostIncidentDocumentUrl)" } ] }, ], "sections": [ { "facts": [ { "name": "Service:", "value": "$($inc.service)" }, { "name": "Status:", "value": "$($inc.Status)" }, { "name": "Classification:", "value": "$($inc.classification)" } ], "text": $($Message) } ], "summary": "$($Inc.Title)", "themeColor": "$($color)", "title": "$($Inc.Id) - $($Inc.Title)" } "@ Invoke-RestMethod -uri $uri -Method Post -body $Payload -ContentType 'application/json; charset=utf-8' } }

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Find the length of an email attachment name.

    1 project | /r/PowerShell | 27 Jun 2023
  • Container access to containers based on azure AD groups

    2 projects | /r/Traefik | 16 May 2023
  • Filtering app names that start with

    1 project | /r/PowerShell | 4 May 2023
  • Have you worked with Microsoft Graph API?

    1 project | /r/programming | 3 May 2023
  • AzureAD -filter string multiple values

    1 project | /r/PowerShell | 26 Jan 2023