Calling Graph API
4 TopicsMeeting time returned incorrectly/Incorrect time code
Hi everyone, So I'm putting an app together internally at work that scrapes the reminders set for us in ZenDesk using the reminders app, converts them and then pushes the events to my Outlook calendar. The pushing is fine and they show up at the right time in my calendar like so: However when I go to pull the events from graph to make sure I'm not uploading duplicates I get the following: Which means that the comparison is failing as the time is an hour behind. Am I missing something here or is MS using the wrong time code? It's currently Summer where I'm based (UK) and the clocks are an hour ahead so UTC should be +1 too right? I'd be super appreciative to anyone who can help. Cheers.559Views0likes1CommentHelp implementing authentication for MS Teams Bot
My team is planning on building an MS Teams Bot (nodeJS) that would be used to send and schedule notifications to users within a company (Multi-Tenant). Were planning on implementing the following workflow: 1. have an admin user within an external company install/authorize our app into their MS Teams instance 2. obtain a tokens from the step above that our app would be able to persist 3a. admin user would schedule a notification for a future date 4a. once future date arrives, bot is able retrieve persisted tokens (perhaps use refresh token to obtain new) and then send message to specific users 3b. admin user wants to push a notification to specific users 4b. bot is able retrieve persisted tokens (perhaps use refresh token to obtain new) and then send message to specific users Slack offers a flow where a "bot token" is obtained rather than a user token which can then be leveraged to send notifications at a later point. For some reference, something like this is similar to what we want: https://stackoverflow.com/a/47509000/5431797 Can you point me towards the right direction for making something like this work in MS Teams ?1.6KViews0likes2CommentsGet MFAStatus with API
Hi, I'm trying to get a report for the MFA status for all my tenant users. # Replace the values in the following variables with your own $clientId = "your_client_id_here" $clientSecret = "your_client_secret_here" $tenantId = "your_tenant_id_here" # Authenticate using Microsoft Graph API $tokenBody = @{ Grant_Type = "client_credentials" Scope = "https://graph.microsoft.com/.default" Client_Id = $clientId Client_Secret = $clientSecret } $tokenResponse = Invoke-RestMethod -Method POST -Uri "https://login.microsoftonline.com/$tenantId/oauth2/v2.0/token" -Body $tokenBody $accessToken = $tokenResponse.access_token # Retrieve all users in the tenant $users = Invoke-RestMethod -Method GET -Uri "https://graph.microsoft.com/v1.0/users" -Headers @{Authorization = "Bearer $accessToken"} # Loop through each user and retrieve their MFA status foreach ($user in $users.value) { $userId = $user.id $mfaStatus = Invoke-RestMethod -Method GET -Uri "https://graph.microsoft.com/v1.0/users/$userId/authentication/strongAuthenticationMethods" -Headers @{Authorization = "Bearer $accessToken"} $mfaEnabled = $mfaStatus.value | Where-Object {$_.state -eq "enabled"} Write-Output "$($user.displayName) - MFA Enabled: $($mfaEnabled -ne $null)" } I got this script but I'm always getting an error when I'm trying to execute it ... error is : Line | 17 | $users = Invoke-RestMethod -Method GET -Uri "https://graph.microsoft. … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | {"error":{"code":"Authorization_RequestDenied","message":"Insufficient privileges to complete the | operation.","innerError":{"date":"2023-03-28T00:21:46","request-id":"d929a2d8-ca16-44b4-af0b-4d514c15ea78","client-request-id":"d929a2d8-ca16-44b4-af0b-4d514c15ea78"}}} In my API permission, I've double check to be sur all permission are ok : UserAuthenticationMethod.Read.All or UserAuthenticationMethod.ReadWrite.All (for Microsoft Graph API v1.0) OR AuthenticationMethod.Read.All or AuthenticationMethod.ReadWrite.All (for Microsoft Graph API beta) User.Read.All or User.ReadWrite.All (for Microsoft Graph API v1.0) OR Directory.Read.All or Directory.ReadWrite.All (for Microsoft Graph API beta) I've check again my clientID-clientSecret-TenanID and seems to be good : How to be sure this is OK? Any log in AzureAD to check if at least my script is able to authenticate? Thanks in advance!2.8KViews0likes10Comments