代码之家  ›  专栏  ›  技术社区  ›  saltillokid11

MailKit.imap文件夹:在类型中找不到方法搜索

  •  0
  • saltillokid11  · 技术社区  · 5 年前

    在调试过程中,我把范围缩小到搜索方法。我试过Mailkit2.0.6、2.7.0和.NET4.5。

    有人知道这里怎么了吗?

    窗户

    client.Inbox.Search(SearchQuery.SubjectContains("Automation Test Schedule Subject: 6/19/2020 4:57:04 PM")); {11234} Count: 1 IsReadOnly: false SortOrder: Ascending Validity: 0 Results View: Expanding the Results View will enumerate the IEnumerable

    client.Inbox.Search(SearchQuery.SubjectContains("Automation Test Schedule Subject: 6/19/2020 5:36:12 PM")); Method 'Search' not found in type 'MailKit.IMailFolder'.

    代码

    using (var client = new ImapClient())
        {
            // connect to email client
            client.Connect(RandomOutlookAccnt);
            client.Authenticate(EmailAddress, Password);
            client.Inbox.Open(FolderAccess.ReadOnly);
    
        client.Idle(cts.Token);
    
        var query = SearchQuery.SubjectContains(emailSubject);
    
        // search unique ids of the emails in inbox 
        var uids = client.Inbox.Search(query);
        var items = client.Inbox.Fetch(uids, MessageSummaryItems.UniqueId | MessageSummaryItems.BodyStructure);
    
    
        . . . other stuff
    
    }
    
    0 回复  |  直到 5 年前
        1
  •  0
  •   jstedfast    5 年前

    这里唯一的解释是Linux上的程序加载了错误的MailKit程序集。

    请确保将程序捆绑在一起,并使用与编译程序时使用的MailKit版本完全相同的版本来运行它。

    推荐文章