Skip to content

How to get Channel messages and replies #804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Ofer-Gal opened this issue Aug 5, 2021 · 2 comments
Closed

How to get Channel messages and replies #804

Ofer-Gal opened this issue Aug 5, 2021 · 2 comments
Assignees

Comments

@Ofer-Gal
Copy link

Ofer-Gal commented Aug 5, 2021

When I used only PnP.powershell, I could get a token and use it to do pure Graph REST call

$token = Get-PnPGraphAccessToken 
$header = @{ Authorization = "Bearer $($token)" }
$Uri = "https://graph.microsoft.com/v1.0/teams/$($team.GroupId)/channels/$($channel.Id)/messages/$($message.Id)/replies" 
$response = Invoke-RestMethod -Uri $Uri –Headers $header –Method Get –ContentType "application/json"

I added Microsoft.Graph.Mail to the script to send email (works fine) but now I get error:

Could not load file or assembly 'System.IdentityModel.Tokens.Jwt, Version=6.11.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find
     | or load a specific file. (0x80131621)

On the line $token = Get-PnPGraphAccessToken
So I thought I replace the pure Graph REST call with a call using -Module -Name Microsoft.Graph.Teams
I can't find any documentation that will show how to get replies with it.
Can someone please show an example?
Thanks
AB#10530

@ghost ghost added the ToTriage label Aug 5, 2021
@peombwa peombwa self-assigned this Aug 10, 2021
@ghost ghost removed the ToTriage label Aug 10, 2021
@peombwa
Copy link
Member

peombwa commented Aug 11, 2021

Hi @Ofer-Gal, this is an issue with the PnP module and not our module. We use version 5.6.0 of System.IdentityModel.Tokens.Jwt and handle dependency resolution on our own.

I would suggest you open an issue with PowerShell PnP for them to fix it - https://github.com/pnp/powershell/issues.

This could be related to pnp/powershell#488.

@peombwa
Copy link
Member

peombwa commented Aug 11, 2021

Closing since the error is from PowerShell PnP module.

@peombwa peombwa closed this as completed Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants