Check Inbox

This application demonstrates how to open the inbox, get the contents, open a message and set the 'IsRead' property.

Example code:


    // get the default messagestore
    MsgStore := EWSSession.OpenDefaultMsgStore;

    // open the inbox folder
    Folder := MsgStore.GetFolder(dfinInbox);

    // get the contenttable for the inbox
    ContentTable := Folder.GetItems;

    // specify the fields we want to retrieve
    // The PR_ENTRYID is the most important property
    // this is the unique identifier of each message
    // we can use the value of this property later on to open the message
    ContentTable.Fields.Add(FLD_ITEM_ITEMID);
    ContentTable.Fields.Add(FLD_ITEM_IMPORTANCE);
    ContentTable.Fields.Add(FLD_MESSAGE_ISREAD);
    ContentTable.Fields.Add(FLD_ITEM_HASATTACHMENTS);
    ContentTable.Fields.Add(FLD_MESSAGE_SENDER);
    ContentTable.Fields.Add(FLD_ITEM_SUBJECT);
    ContentTable.Fields.Add(FLD_ITEM_SIZE);
    ContentTable.Fields.Add(FLD_ITEM_DATETIMERECEIVED);

    // open the table
    ContentTable.Open;

    // loop through the table
    ContentTable.First;
    while not ContentTable.EOF do
    begin
      ContentTable.Next;
    end;

Screenshot:


Back to Examples