.NET Components for Mobility

How to Use MessagingItemEventHandler and outSession.MessagingItemCreated

Last post 07-21-2008 6:35 AM by hibbert.de. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 07-08-2008 12:52 PM

    How to Use MessagingItemEventHandler and outSession.MessagingItemCreated

     How to Use MessagingItemEventHandler and outSession.MessagingItemCreated in 3.2 version.

     

    Thanks

     

  • 07-08-2008 12:58 PM In reply to

    Re: How to Use MessagingItemEventHandler and outSession.MessagingItemCreated

     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());
    }

  • 07-17-2008 9:59 AM In reply to

    Re: How to Use MessagingItemEventHandler and outSession.MessagingItemCreated

    hi,

    i there a sample code for vb.net?

     

    thanks hibbert.de 

    sorry for my bad english
  • 07-18-2008 3:15 AM In reply to

    Re: How to Use MessagingItemEventHandler and outSession.MessagingItemCreated

    Dim session As New OutlookSession()

    AddHandler session.MessagingItemCreated, AddressOf Form1_MessagingItemCreated

    Public Sub Form1_MessagingItemCreated(ByVal sender As Object, ByVal e As MessagingItemEventArgs)
        MessageBox.Show("EventFired: " + e.ItemId)
        Dim ex As New EmailMessage(e.ItemId)
        MessageBox.Show(ex.From.ToString() + ": " + ex.BodyText.ToString())
    End Sub

    http://oldsap.blogspot.com
  • 07-18-2008 3:49 AM In reply to

    Re: How to Use MessagingItemEventHandler and outSession.MessagingItemCreated

    Hi, thanks for your fast reply =)

     i tried it but i get no message that a new mail arrives :(  

     

    i also tried an application in c#, there it works, but i want to develop my application vb.net, because c# isn't my prefered language ;) 

     

    thanks again,

    hibbert.de 

    sorry for my bad english
  • 07-18-2008 6:03 AM In reply to

    Re: How to Use MessagingItemEventHandler and outSession.MessagingItemCreated

    There is no reason why the event would work from C# but not VB unless there is an error in your code. Make sure your OutlookSession is defined in the scope of your form so it doesn't get freed up while in use e.g.

    Private OutlookSession session = New OutlookSession()

    in your form code, not the constructor or Form_Load method.

     

    Peter

    Peter Foot
    Microsoft Device Application Development MVP
    www.peterfoot.net | www.inthehand.com
  • 07-18-2008 8:20 AM In reply to

    Re: How to Use MessagingItemEventHandler and outSession.MessagingItemCreated

    Hi Peter,

    i tried it this way:

    Imports InTheHand.WindowsMobile.PocketOutlook

    Public Class Form1
        Private session As New OutlookSession()

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            AddHandler session.MessagingItemCreated, AddressOf Form1_MessagingItemCreated
        End Sub
        Public Sub Form1_MessagingItemCreated(ByVal sender As Object, ByVal e As MessagingItemEventArgs)
            Dim ex As New EmailMessage(e.ItemId)
            MessageBox.Show(ex.From.ToString() + ": " + ex.BodyText.ToString())
        End Sub

        Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
            Me.Close()
        End Sub
    End Class

    but i get no message and/or the event is not raised.

     

    thanks hibbert.de 

    sorry for my bad english
  • 07-21-2008 6:35 AM In reply to

    Re: How to Use MessagingItemEventHandler and outSession.MessagingItemCreated

    Hello there,

    i've tried it in C# but i don't get the bodytext... here is a screenshot of my debugging-result:


    So why is the bodytext empty? is there a solution for it? and is there any example which works under vb.net?

     

    thanks hibbert.de 

     

    sorry for my bad english
Page 1 of 1 (8 items)
Copyright © 2001-2008 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy.