Closed Jurysko closed 3 years ago
Hey @Jurysko,
Thanks for raising this.
Are you able to provide the sample of the response you get back by running the sample below and sharing the values of the content? This will help us understand better what could be happening in your scenario.
var messageResponse = await graphClient.Me.Messages["message-id"]
.Request()
.Expand("extensions($filter=id%20eq%20'Microsoft.OutlookServices.OpenTypeExtension.Com.Contoso.Referral')")
.GetResponseAsync();
var stringResponse = await messageResponse.Content.ReadAsStringAsync();
Hello, Thanks for reaching me out. I don’t use app with delegated permissions, but app with app permissions. Therefore I am unable to call „.Me“ endpoint. I can create new app with delegated permissions. I called code from your sample with „Users[]“ endpoint resulting with data in attachment. Event the request that is commented out failed in my case with the same exception (I deleted all but 1 message prior to calling the request). I have tried to use different user and got the same exception.
//var messages = (await graphClient.Users[userId].Messages.Request().GetAsync());
var messageResponse = await graphClient.Users[userId].Messages[messageId]
.Request()
.Expand("extensions($filter=id%20eq%20'Microsoft.OutlookServices.OpenTypeExtension.Com.Contoso.Referral')")
.GetResponseAsync();
var stringResponse = await messageResponse.Content.ReadAsStringAsync();
I have checked other development tenant and got the same problem.
Best Regards Jurysko GetResponseAsync.txt
Hey @Jurysko,
Thanks again for the extra information. Unfortunately, I am unable to replicate this error using your sample payload or making a similar call to graph using Microsoft.Graph v4.7.0.
Any chance you are able to give more information if you have specified a version of Microsft.Graph.Core
in your csproj and/or share the contents of the csproj file?
Hello @andrueastman, I am attaching the whole project. If anything else could influence my weird result let me know. ExtendedMessageReadFail.zip Thank you
Sorry about closing this, I really shouldn't be doing 2 things simultaneously.
Hey @Jurysko,
Thanks again for sharing this. I am still unable to replicate the exception reported with the project. I suspect something in the payload on your side might be causing this as the project looks configured correctly.
Since you mentioned that you experience the error on this call as well,
//var messages = (await graphClient.Users[userId].Messages.Request().GetAsync());
Are you able to modify the call as below as well and share the response to help us understand where the issue could be?
var messagesResponse = (await graphClient.Users[userId].Messages.Request().GetResponseAsync());
var stringResponse = await messagesResponse.Content.ReadAsStringAsync();
Console.Out.WriteLine(stringResponse);
Sure, here is the output. GetMessages-GetResponseAsync.txt
Hey @Jurysko,
Unfortunately, I'm still unable to replicate the error and deserializing the payload you provided works without any issue on my end.
To follow up, any chance you can still replicate this with the latest 4.8.0 version of Microsoft graph package?
I reinstalled Visual Studio and problem disappeared. Both requests (get messages and read message with extension) are now working without issues. Sorry about raising this, I didn't expect this could fix anything since I didn't have any other problems with complex projects.
Thank you for your assistance and goodwill
No worries about that @Jurysko
Just to pitch in on this for people coming here in the future.
We had the same issue no matter which endpoint we were calling when using VS2022 (17.0.1). We tried on a different computer which had VS2022 (17.0.2) installed and the code worked fine. We then tried to upgrade the first machine to version 17.0.2 and the code started to work on that machine as well.
We don't know if the issue is caused by a bug in 17.0.1 or If the upgrade caused something to happen similar to a reinstall as @Jurysko did.
Describe the bug Sample from https://docs.microsoft.com/en-us/graph/api/opentypeextension-get?view=graph-rest-1.0&tabs=csharp#request-3 for c# fails with Exception thrown: 'System.InvalidOperationException' in System.Text.Json.dll The requested operation requires an element of type 'Object', but the target element has type 'Array'. at System.Text.Json.JsonDocument.TryGetNamedPropertyValue(Int32 index, ReadOnlySpan`1 propertyName, JsonElement& value)
To Reproduce Steps to reproduce the behavior:
Expected behavior Call succeeds and response is parsed into Message class.
Client version Microsoft.Graph 4.7.0 net5.0
Desktop (please complete the following information):