Skip to content

Microsoft.Graph.Reports - Get-MgReportTeamUserActivityCount #407

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
JohanssonMarkus opened this issue Sep 29, 2020 · 12 comments · Fixed by #1331
Closed

Microsoft.Graph.Reports - Get-MgReportTeamUserActivityCount #407

JohanssonMarkus opened this issue Sep 29, 2020 · 12 comments · Fixed by #1331

Comments

@JohanssonMarkus
Copy link

JohanssonMarkus commented Sep 29, 2020

Get-MgReportTeamUserActivityCount -Period "D7" Give an error

PS H:> Get-MgReportTeamUserActivityCount -Period "D7"
Get-MgReportTeamUserActivityCount : Expected '{' or '['. Was String: Report.
At line:1 char:1

  • Get-MgReportTeamUserActivityCount -Period "D7"
  •   + CategoryInfo          : NotSpecified: (:) [Get-MgReportTeamUserActivityCount_Get1], ParserException
      + FullyQualifiedErrorId : Microsoft.Graph.PowerShell.Cmdlets.GetMgReportTeamUserActivityCount_Get1 
    

AB#7395

@ghost ghost added the ToTriage label Sep 29, 2020
@ghost ghost removed the ToTriage label Oct 1, 2020
@MIchaelMainer
Copy link
Contributor

This is a known issue where the metadata describes this as JSON and the response is csv.

@JohanssonMarkus
Copy link
Author

@MIchaelMainer Ok good to know, when will it be solved?

@MIchaelMainer
Copy link
Contributor

We don't have this scheduled yet on our side, and I'm unaware what the story is on the server side for this API set. This scenario requires the use of Invoke-GraphRequest for now.

@joshtransient
Copy link

Also adding that the cmdlets in Microsoft.Graph.Reports fail when the file specified by -OutFile doesn't already exist.

@darrelmiller
Copy link
Contributor

I was able to repro this issue:

C:\src\msgraph-sdk-powershell [dev ≡ +4 ~2 -0 !]> Get-MgReportTeamDeviceUsageUserCount -Period "D7" -OutFile report.txt
Get-MgReportTeamDeviceUsageUserCount_Get: Cannot find path 'C:\src\msgraph-sdk-powershell\report.txt' because it does not exist.

@georgend georgend self-assigned this Dec 2, 2020
@ddyett ddyett modified the milestones: Post GA, 1.3.0 Dec 2, 2020
@peombwa peombwa modified the milestones: 1.3.0, 1.4.0 Jan 28, 2021
@georgend
Copy link
Contributor

georgend commented Feb 1, 2021

@JohanssonMarkus
A workaround for now would be to use Invoke-MgGraphRequest
The following options:-

-InferOutputFileName :- Infer the output file name and store it in the current directory.

Connect-Graph -Scopes @("Reports.Read.All")
Invoke-MgGraphRequest -Uri "https://graph.microsoft.com/v1.0/reports/getTeamsUserActivityUserDetail(period='D7')" -InferOutputFileName

image

-OutputFilePath :- specify the name of the output file.

Connect-Graph -Scopes @("Reports.Read.All")
Invoke-MgGraphRequest -Uri "https://graph.microsoft.com/v1.0/reports/getTeamsUserActivityUserDetail(period='D7')" -OutputFilePath report.csv

image

You can substitute the -Uri with

@peombwa
Copy link
Member

peombwa commented Apr 16, 2021

The OpenAPI document currently represents the content-type of this response as application/json instead of application/octet-stream. To solve this, we need to ensure that all content-types of report functions are accurately represented in the converted OpenAPI. Without this, code generators won't be able to know how to properly handle responses.

Currently

This in CSDL:
image
image

Gets converted to this in OpenAPI:
image

Expected

For the cmldet to function as described in MS Graph docs, we need to ensure that the response is describes as shown below:
image

cc\ @ddyett , @darrelmiller, @mairissi: Should we address this in the metadata or let DevX API handle it.

@peombwa peombwa modified the milestones: 1.5.0, 1.6.0 Apr 20, 2021
@chenxizhang
Copy link

some error here, do we have plan to fix the issue?

image

@peombwa peombwa modified the milestones: 1.6.0, Backlog May 10, 2021
@peombwa peombwa modified the milestones: Backlog, 1.7.0 Jun 8, 2021
@peombwa
Copy link
Member

peombwa commented Jul 13, 2021

This is being tracked here https://github.com/microsoftgraph/microsoft-graph-devx-api/issues/552 and will be fixed via XSLT transform.

@weyCC81
Copy link

weyCC81 commented Oct 4, 2021

This is still happening with Module "Microsoft.Graph" at Version "1.7.0", please fix

@silijon
Copy link

silijon commented Feb 10, 2022

From what we can tell, the Microsoft.Graph.Reports module is comprehensively broken because of this issue. It's been outstanding for a while. If it can't be fixed on the metadata side, is there any thought to having additional api metadata transforms applied prior to the sdk generation? That would at least insulate the sdk from inheriting upstream problems that can't be fixed for years at a time....

@maisarissi
Copy link

Hi @silijon . We have been working with other teams to get this fixed.
As you can see here the team managed to fix and now we are just waiting for the next version release to be out so we can validate on our side.
Once we get this done, we will update and close this issue.

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