Jun 05 2023 02:55 AM - edited Jun 05 2023 02:56 AM
Hello,
I'm trying to generate Channel's email through GraphApi.
It works well when I'm a member of the Teams but when I try to generate one with a Team/Channel, I'm not member of, I receive a weird error "Bad Request"
I've tried through "Application Context" and "Delegate Context" but still not working. (New-MgTeamChannelEmail can't be use in Application Context though)
$CLientID="whatever"
$TenantID="whatever2"
$myAccessToken = Get-MsalToken -ClientId $clientID -TenantId $tenantID -Scopes 'https://graph.microsoft.com/.default' -RedirectUri 'https://login.microsoftonline.com/common/oauth2/nativeclient'
# $myAccessToken = Get-MsalToken -ClientId $clientID -TenantId $tenantID -ClientSecret $clientSecret -Scopes 'https://graph.microsoft.com/.default' -RedirectUri 'https://login.microsoftonline.com/common/oauth2/nativeclient'
$token = $myAccessToken.AccessToken
Connect-MgGraph -AccessToken $token
# Set the baseurl to MS Graph-API (BETA API)
$baseUrl = 'https://graph.microsoft.com/1.0'
# Pack the token into a header for future API calls
$header = @{
'Authorization' = "Bearer $($Token)"
}
$TeamId="WhateverNumber"
$ChannelId="WhateverNumber"
# write-host $userPurpose.value
$generatedemail = New-MgTeamChannelEmail -TeamId $TeamId -ChannelId $ChannelId
Any ideas ?
Jun 05 2023 07:59 AM
Jun 06 2023 12:40 AM