.NET Components for Mobility

Email Notifications for v3.2

Last post 06-19-2008 5:25 AM by JWay. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 06-14-2008 9:38 AM

    • JWay
    • Top 150 Contributor
    • Joined on 06-14-2008
    • Posts 5

    Email Notifications for v3.2

    Hello, Version 3.2 mentions message notifications. Does this extend to email messages as well or would it makes sense to just use the Microsoft.windowsmobile.status assembly instead? If this feature does exist could anyone point me in the right direction?
    Filed under:
  • 06-15-2008 9:07 AM In reply to

    Re: Email Notifications for v3.2

    The OutlookSession object has a number of new events for actions happening in the message store. You can hook the MessagingItem* events to watch for particular changes. The EventArgs received will indicate the ItemId of the affected message/folder and you can open the item using either the constructor for the specific type which accepts an ItemId e.g. new EmailMessage(e.ItemId) or use the GetItemFromItemId method of the OutlookSession.

    Peter

    Peter Foot
    Microsoft Device Application Development MVP
    www.peterfoot.net | www.inthehand.com
  • 06-17-2008 3:59 PM In reply to

    • JWay
    • Top 150 Contributor
    • Joined on 06-14-2008
    • Posts 5

    Re: Email Notifications for v3.2

    Thank you Peter. Your suggestion worked very well.
    Here is the code I have used:

    OutlookSession session = new OutlookSession();
    session.MessagingItemCreated += new MessagingItemEventHandler(Form1_MessagingItemCreated);

    public void Form1_MessagingItemCreated(object sender, MessagingItemEventArgs e)
    {
    MessageBox.Show("EventFired: " + e.ItemId);
    EmailMessage ex = new EmailMessage(e.ItemId);
    MessageBox.Show(ex.From.ToString() + ": " + ex.BodyText.ToString());
    }
  • 06-19-2008 5:25 AM In reply to

    • JWay
    • Top 150 Contributor
    • Joined on 06-14-2008
    • Posts 5

    Re: Email Notifications for v3.2

    I have found that I need to put a System.Threading.Thread.Sleep(1000) into the MessagingItemCreated event handler. If I don't do this I get a null reference exception when trying to print out: MessagingItemEventArgs e.ItemId Is there some kind of timing issue that I'm missing? Thanks, James
Page 1 of 1 (4 items)
Copyright © 2001-2008 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy.