-
Notifications
You must be signed in to change notification settings - Fork 242
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
Unable to set QueryParamters/Format #2465
Comments
Thanks for raising this @GrahamSnee This is related to the metadata that generates the SDK(created microsoftgraph/msgraph-metadata#616 for this.) In the meantime, you can probably customize your response as below by using the var urlString = graphClient.Reports.GetM365AppPlatformUserCountsWithPeriod("{period}").ToGetRequestInformation().URI.OriginalString;
urlString += "?$format=application/json";//append the query parameter
var responseStream = await graphClient.Reports.GetM365AppPlatformUserCountsWithPeriod("").WithUrl(urlString).GetAsync(); |
I have tried this, but the client thrown an exception stating ‘{"Message":"JSON format is not supported."}’ |
Thanks for getting back to this. It looks like the API may not support the json type for this scenario(Which suggests that the documenation is invalid/incorrect). Are you by any chance able to replicate this using the Graph explorer? |
With Graph explorer it does not work, but neither does the getting of the information in CSV work either |
Describe the bug
I am wanting to use the GraphServiceClient to get the reports GetM365AppUserDetailWithPeriod. I want to use the format of the return to be in JSON, so using the example from the MS documents I have tried to pass the requestConfiguration query parameters format, but the code will not compile. The complier indicates a missing using statement, but the code matches the examples. (https://learn.microsoft.com/en-us/graph/api/reportroot-getm365appplatformusercounts?view=graph-rest-1.0&tabs=csharp)
Expected behavior
The code to compile, or documents be updated to reflect required usings within the examples
How to reproduce
Create a simple app and add the code
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Reports.GetM365AppPlatformUserCountsWithPeriod("{period}").GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Format = "application/json";
});
SDK Version
nuget package 5.49.0
Latest version known to work for scenario above?
Unkownn
Known Workarounds
None
Debug output
Compiler Error CS1061 'DefaultQueryParameters' does not contain a definition for 'Format' and no accessible extension method 'Format' accepting a first argument of type 'DefaultQueryParameters' could be found (are you missing a using directive or an assembly reference?)
Configuration
Windows 11
Other information
No response
The text was updated successfully, but these errors were encountered: