Skip to content
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

Get-MgTeamChannelMessageCount doesn't work #2585

Open
12Knocksinna opened this issue Feb 11, 2024 · 1 comment
Open

Get-MgTeamChannelMessageCount doesn't work #2585

12Knocksinna opened this issue Feb 11, 2024 · 1 comment

Comments

@12Knocksinna
Copy link

Thanks for reporting the bug. Please ensure you've gone through the following checklist before opening an issue:

Describe the bug
I assume that the Get-MgTeamChannelMessageCount cmdlet should return the count of messages in a channel. It doesn't work. At least, none of the experiments I have done have extracted any value from the cmdlet. The documentation for this cmdlet is absolutely awful, which doesn't help.

To Reproduce
Run the cmdlet and provide the id for a team and channel.

Expected behavior
I expect the count of channel messages to be returned.

Debug Output
Get-MgTeamChannelMessageCount -TeamId $Team.Id -ChannelId $SelectedChannel.Id -debug
DEBUG: [CmdletBeginProcessing]: - Get-MgTeamChannelMessageCount begin processing with parameterSet 'Get'.
DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'.
DEBUG: [Authentication]: - Scopes: [AccessReview.Read.All, Agreement.Read.All, Analytics.Read, APIConnectors.Read.All, Application.Read.All, Application.ReadWrite.All, AppRoleAssignment.ReadWrite.All, AuditLog.Read.All, Channel.ReadBasic.All, ChannelMessage.Read.All, ChannelMessage.ReadWrite, ChannelMessage.Send, ChannelSettings.Read.All, ChannelSettings.ReadWrite.All, Chat.ManageDeletion.All, Chat.ReadWrite, Community.ReadWrite.All, Contacts.ReadWrite, CrossTenantUserProfileSharing.Read, CrossTenantUserProfileSharing.Read.All, DelegatedPermissionGrant.ReadWrite.All, Directory.AccessAsUser.All, Directory.Read.All, Directory.ReadWrite.All, email, EntitlementManagement.Read.All, Group.Read.All, Group.ReadWrite.All, GroupMember.Read.All, GroupMember.ReadWrite.All, IdentityProvider.Read.All, IdentityProvider.ReadWrite.All, IdentityRiskyUser.Read.All, IdentityRiskyUser.ReadWrite.All, IdentityUserFlow.Read.All, Mail.Read, Mail.ReadWrite, Mail.Send, Mail.Send.Shared, OnlineMeetingArtifact.Read.All, OnlineMeetings.Read, openid, Organization.Read.All, PeopleSettings.Read.All, PeopleSettings.ReadWrite.All, Place.Read.All, Policy.Read.All, Policy.Read.PermissionGrant, Policy.ReadWrite.ApplicationConfiguration, Policy.ReadWrite.ConditionalAccess, PrivilegedAccess.Read.AzureAD, PrivilegedAccess.Read.AzureResources, profile, Reports.Read.All, ReportSettings.ReadWrite.All, RoleAssignmentSchedule.Read.Directory, RoleAssignmentSchedule.ReadWrite.Directory, RoleEligibilitySchedule.Read.Directory, RoleManagement.Read.All, RoleManagement.Read.Directory, SecurityActions.ReadWrite.All, SecurityEvents.Read.All, SecurityEvents.ReadWrite.All, ServiceHealth.Read.All, ServiceMessage.Read.All, SharePointTenantSettings.ReadWrite.All, Sites.FullControl.All, Sites.Manage.All, Sites.Read.All, Sites.ReadWrite.All, Tasks.Read, Tasks.ReadWrite, Team.ReadBasic.All, TeamMember.Read.All, TeamSettings.Read.All, TeamsTab.Read.All, TeamworkTag.ReadWrite, User.Read, User.Read.All, User.ReadBasic.All, User.ReadWrite.All, UserAuthenticationMethod.Read.All, UserAuthenticationMethod.ReadWrite.All, VirtualEvent.Read].
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://graph.microsoft.com/v1.0/teams/84fe8ec1-d85f-4564-a786-1f7bedd9862c/channels/19%3A8819a57f357b4d538d116bdb80111755%40thread.skype/messages/$count

Headers:
FeatureFlag : 00000043
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.22631; en-IE),PowerShell/7.4.1
Accept-Encoding : gzip
SdkVersion : graph-powershell/2.13.1
client-request-id : 2e0184b2-70c8-40f9-94ed-ab4b45f1191f

Body:

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
NotFound

Headers:
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : edfc06b3-7e84-4e37-9c35-fcc5179d057a
client-request-id : 2e0184b2-70c8-40f9-94ed-ab4b45f1191f
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"002","RoleInstance":"DU2PEPF0001080B"}}
Date : Sun, 11 Feb 2024 23:21:38 GMT

Body:
{
"error": {
"code": "NotFound",
"message": "Requested API is not supported. Please check the path.",
"innerError": {
"date": "2024-02-11T23:21:39",
"request-id": "edfc06b3-7e84-4e37-9c35-fcc5179d057a",
"client-request-id": "2e0184b2-70c8-40f9-94ed-ab4b45f1191f"
}
}
}

Get-MgTeamChannelMessageCount_Get: Requested API is not supported. Please check the path.

Status: 404 (NotFound)
ErrorCode: NotFound
Date: 2024-02-11T23:21:39

Headers:
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : edfc06b3-7e84-4e37-9c35-fcc5179d057a
client-request-id : 2e0184b2-70c8-40f9-94ed-ab4b45f1191f
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"002","RoleInstance":"DU2PEPF0001080B"}}
Date : Sun, 11 Feb 2024 23:21:38 GMT

DEBUG: [CmdletEndProcessing]: - Get-MgTeamChannelMessageCount end processing.

Module Version

Please run Get-Module Microsoft.Graph* after cmdlet execution and paste the output below.
If a module cannot be installed or imported, please run Get-Module -ListAvailable and paste the output.

Environment Data
$PSVersionTable

Name Value


PSVersion 7.4.1
PSEdition Core
GitCommitId 7.4.1
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

@12Knocksinna 12Knocksinna changed the title Get-MgTeamChannelMessageCount doesn;'t work Get-MgTeamChannelMessageCount doesn't work Feb 12, 2024
@timayabi2020
Copy link
Contributor

Hi @12Knocksinna thanks for logging this issue.
I tried reproducing the issue using graph explorer and I was getting the same result as shown on your debug information.

Further checks revealed that the Odata $count query parameter is not supported for the path /teams/{team-id}/channels/{channel-id}/messages. This is as per the API reference documentation here.

image

I have also logged an issue here with the metadata team.

For now, I would suggest you consider using (Get-MgTeamChannelMessage -TeamId $tenantId -ChannelId $channelId).count

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants