简体   繁体   中英

Problem searching for specific Mails using MS-Graph API

I have a WPF-Application that uses the MS-Graph API, to search for EMails containing a specific keyword and display them to the user.

To get only the mails a user searches for, the MS-Documentation recomments this:

var messages = await graphClient.Me.Messages
.Request()
.Search("Pizza")
.GetAsync();

The problem is, this doesn't work in my code and I can't figure out why. The only thing my VS tells me is that it could not resolve symbol "search" and I didn't find anything about this problem here or somewhere else on the internet.

The way I'm doing it at the moment is this:

        var queryOption = new List<QueryOption>()
        {
            new QueryOption("$search", "Pizza")
        };
        var messages = await serviceClient.Me.Messages.Request(queryOption).GetAsync();

This works as expected, but does anyone now how to do it as shown in the MS-Documentation?

I would appreciate any help!

Currently, there is no search method available for the IUserMessagesCollectionRequest object, so you are using it correctly. This is also described here:

https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/dev/docs/overview.md#custom-query-options

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM