1

While investigating an upgrade of my C# use of Microsoft GraphServiceClient v4 to v5 I was looking at the usage I have of the chats: getallMessages for which I need to be able to append the "model" query string parameter this format:

GET /users/{id | user-principal-name}/chats/getAllMessages?model=A

In v4 it would look like:

string userGuidString = ...
GraphServiceClient gsc = ...
var results = await new UserChatsCollectionRequestBuilder(
   gsc.Users[userGuidString].Chats.GetAllMessages().AppendSegmentToRequestUrl("?model=A")
   , gsc.Request().GetAsync();

Checking the MS upgrade guide I see only one mention of the AppendSegmentToRequestUrl which was only how to stop using it for the $count piece and use a built in method.

The best I can come up with for v5 is to deal with it myself by using the Uri class.

string userGuidString = ...
GraphServiceClient gsc = ...
var results = await new Microsoft.Graph.Users.Item.Chats.GetAllMessages.GetAllMessagesRequestBuilder(
   new Uri(gsc.Users[userGuidString].Chats.GetAllMessages.ToGetRequestInformation().URI, "?model=A").ToString()
   , gsc.RequestAdapter).GetAsync();

Sure this works, but since they didn't call out this issue in the upgrade guide it seems like I must be missing how to do this in the v5 syntax. Is there a way?

  • Yes, it's bug in SDK v5. Time to time, the similar problem is found for another endpoint and when you create a new ticket, they will fix it. https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues/new/choose Then you should be able to use var result = await graphClient.Users["{user-id}"].Chats.GetAllMessages.GetAsync(rc =>{rc.QueryParameters.Model = "A";}); – user2250152 Jun 16 '23 at 06:56
  • Thanks @user2250152, I have filed bug https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues/1972 – David R. K. DeLoveh Jun 16 '23 at 20:44

0 Answers0