What is the LINQ if I wanted to get everything in the INBOX

Apr 9, 2013 at 11:57 AM
Assuming I already selected the inbox


for example...I have this statement..

var messages = imapClient.Messages.Where(w => w.Date <= DateTime.Now).Select(x => x.Envelope).OrderByDescending(m => m.Date).ToList();

But it only gets me half the email items I need. Is there a way to get "ALL" without having a where or a select? I need all the items under x...not just envelope OR body structure.

Is there a way to express that?

-Paul Mauriello
Apr 12, 2013 at 3:01 PM
Solved this problem by adding a container class like so

public class MyContainer
    public Crystalbyte.Equinox.Imap.Envelope Envelope { get; set; }
    public Crystalbyte.Equinox.Imap.MessageInfo BodyStructure { get; set; }
    public string Text { get; set; }

    #region Constructor(s)

    public MyContainer() { }

    public MyContainer(
        Crystalbyte.Equinox.Imap.Envelope Envelope,
        Crystalbyte.Equinox.Imap.MessageInfo BodyStructure,
        string Text
        this.Envelope = Envelope;
        this.BodyStructure = BodyStructure;
        this.Text = Text;

    #endregion Constructor(s)

And then evoking the query like so
            var query = imapClient.Messages.Where(w => w.Uid > 0).Select(
               x => new MyContainer()
                   Envelope = x.Envelope,
                   BodyStructure = x.BodyStructure,
                   Text = x.Text 
            var messages = query.ToList();
this bundles everything I need into one message object