I'm using MSAL and the MS Graph SDK to try and learn about calling Graph API as I am new to all of this. I also have the MS Graph Explorer up to execute HTTP requests, see the results and then try to recreate those same queries in the console app using the graph client library. I've been able to duplicate most I've tried so far except for one where I am trying to search a specific user's messages for a certain subject.
I enter this into Microsoft's Graph Explorer: https://graph.microsoft.com/v1.0/users/XXX-XXXX-XXXX-XXXX-XXXX/messages?$search="subject:test" with a valid user ID. I get back the correct message in the response. I then click on the "Code snippets" tab at the bottom and then the "CSharp" sub tab and it gives me this sample C# code snippet:
+++++++++++++++++++++
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var messages = await graphClient.Users["XXX-XXXX-XXXX-XXXX-XXXX"].Messages
.Request()
.Search("subject:test")
.GetAsync();
+++++++++++++++++++++
I have a console app already set up with all the auth and client app generation in place so I alter it to take the graph explorer generated snip and get a complie-time error: "'IUserMessagesCollectionRequest' does not contain a definition for 'Search' and no accessible extension method 'Search' accepting a first argument of type 'IUserMessagesCollectionRequest' could be found (are you missing a using directive or an assembly reference?)".
I can use Filter() instead of Search() to get the correct result, but I'm trying to understand why Search() is not present. I wasn't using beta version...just standard v1.0. Do the graph explorer generated code snippets not always generate entries that can be used in .NET client apps using the graph SDK?
Thanks in advance.
-Mike