Solved

ItemAddEvent not firing with Redemption - Outlook freezing

Posted on 2008-06-11
2
609 Views
Last Modified: 2013-12-17
I had a piece of code which allow me to make special actions on new mails which arrived in a public folder. But as i asked for the SenderName, i had the outlook security window which appeard every ten minutes. To get out of this problem, i have installed redemption, and change the code. The code is no more working. In fact, as soon as a new mail arrive i cant access Outlook anymore, its freezing.

I post the old and the new code, to see if someone can find the issue.

Thanks for assistance

#################################################

########## THE OLD ONE W/O REDEMPTION ###########

#################################################
 

public void ReceptionMail(Outlook.Application o)

        {

            Outlook.MAPIFolder fldInbox;

            Outlook.NameSpace olNs;

            olNs = o.GetNamespace("MAPI");

            fldInbox = olNs.GetDefaultFolder(Outlook.OlDefaultFolders.olPublicFoldersAllPublicFolders).Folders["Blabla"];
 

            fldInbox.Items.ItemAdd += new Outlook.ItemsEvents_ItemAddEventHandler(Items_ItemAdd);
 

            Console.WriteLine("Please wait for new messages...");

            Console.ReadLine();

        }
 

        private void Items_ItemAdd(object Item)

        {

            Console.WriteLine("New Message")

        }
 

#########################################################

############### THE NEW CODE W REDEMPTION ###############

#########################################################
 

 public void ReceptionMail(Outlook.Application o)

        {

            RDOFolder fldInbox;

            Outlook.NameSpace olNs;

            olNs = o.GetNamespace("MAPI");

            Redemption.RDOSessionClass rdoSession = new Redemption.RDOSessionClass();

            rdoSession.MAPIOBJECT = olNs.MAPIOBJECT;

            fldInbox = rdoSession.GetDefaultFolder(rdoDefaultFolders.olPublicFoldersAllPublicFolders).Folders["Blabla"];

            fldInbox.Items.ItemAdd += new IRDOItemsEvents_ItemAddEventHandler(Items_ItemAdd);
 

            Console.WriteLine(fldInbox.Items.Count);

            Console.WriteLine("Please wait for new messages...");

            Console.ReadLine();

        }
 

        public void Items_ItemAdd(object Item)

        {

           Console.WriteLine("New Message")

        }

Open in new window

0
Comment
Question by:Emzed
2 Comments
 
LVL 28

Accepted Solution

by:
peakpeak earned 500 total points
Comment Utility
There's a better solution (IMHO). You use a script that put the mail in the Outbox:
http://www.everythingaccess.com/tutorials.asp?ID=Outlook-Send-E-mail-without-Security-Warning
0
 

Author Comment

by:Emzed
Comment Utility
Find how to solve this matter,

Use SafePostItem with the first code

            SafePostItem postitem = new SafePostItemClass();
            postitem.Item = Item;
            TraitementMail(postitem);
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

It’s a strangely common occurrence that when you send someone their login details for a system, they can’t get in. This article will help you understand why it happens, and what you can do about it.
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
The purpose of this video is to demonstrate how to set up a Mailchimp campaign. This will include styling and adding elements to a newsletter/email. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchim…
The purpose of this video is to demonstrate how to set up Lists in Mailchimp. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchimp account. : Click on Lists. Click on Create List Button : Choose the desi…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now