Menu

example of using IMAPIAdviseSink?

2009-07-26
2013-04-26
  • Chet Striker

    Chet Striker - 2009-07-26

    If anyone could please help with a solid example, here is an attempt I started to try to call a function called "NEW_OUTGOING" when ever a new sms message is being sent, hopefully somebody can show me what's wrong with it? Or if not will this, then any cemail event triggering examples. I know how to cycle through and look up any sms. email, etc but cant figure out how to properly call the handlers.

    // *********** CHECK FOR NEW OUTGOING MAIL **************************** //
                 MAPI map = new MAPI();
                 //create notification for new outgoing mail
                 cemapi.NEWMAIL_NOTIFICATION notify=new cemapi.NEWMAIL_NOTIFICATION(null,null,EMessageFlags.MSGFLAG_SUBMIT);
                
                 //get all stores
                 IMAPIMsgStore[] stores= map.MessageStores;
                 //cycle through all until sms store is found
                 foreach (IMAPIMsgStore store in stores)
                    {
                      if (store.DisplayName == "SMS")
                      {
                        //open the outbox of sms
                        IMAPIFolder ifold = store.OutboxFolder.OpenFolder();
                        //set notify to monitor SMS outbox for new messages
                        notify = new cemapi.NEWMAIL_NOTIFICATION(ifold.EntryID, store.EntryID, EMessageFlags.MSGFLAG_UNSENT);
                      }
                    }
                    //completely lost, trying to create handler to launch NEW_OUTGOING function when new SMS messages are sent
                    cemapi.AdviseNewMailHandler mail = new cemapi.AdviseNewMailHandler(NEW_OUTGOING);
                    mail += new cemapi.AdviseNewMailHandler(NEW_OUTGOING);
                    mail.Invoke(EEventMask.fnevObjectMoved, notify);

    // *********** CHECK FOR NEW OUTGOING MAIL **************************** //

     
  • Awais Abbasi

    Awais Abbasi - 2009-12-07

    hello

    did you find solution to your problem , can you please share it here i also looking for it

    Thanks

     

Log in to post a comment.