Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Outlook security warning - A program is trying to access outlook

223 views
Skip to first unread message

Dilum

unread,
Aug 10, 2007, 12:02:01 AM8/10/07
to
Our application converts various text document formats to text files. Users
can use the application to select a supported file (doc, pdf, msg etc.) to
generate a text file (.txt) .

But there is an issue with converting Outlook message files (.msg) to text
files. When trying to read the msg file with an Outlook object, a pop-up
window comes from Outlook saying that a program is trying to access Outlook.
So the users always have to grant access to the application whenever they try
to generate a text file from msg files.

The code block is shown below.
The variable “path” contains the file path to the message file.

// Create Outlook Application Object
Microsoft.Office.Interop.Outlook.ApplicationClass objOutlook =
newMicrosoft.Office.Interop.Outlook.ApplicationClass();

//Create Null Ref Object
object nullobj = System.Reflection.Missing.Value;

// Outlook Mail Object
Microsoft.Office.Interop.Outlook.MailItem msgItem;

// Open Mail file
msgItem =
(Microsoft.Office.Interop.Outlook.MailItem)objOutlook.CreateItemFromTemplate(path,nullobj);

// Extract Plain Text
string plainText = msgItem.Body.ToString();

// Cleanup Resources.
objOutlook.Quit();
objOutlook = null;

return plainText;

The application uses COM INTEROPS of Office XP, Office 2003 and Office 2007
to generate text files. First, the available version is checked and then uses
INTEROPS of that particular version to generate text files.

The application doesn’t need to access the Outlook application, because
users select a file available in the local file system using a file-open
dialog box.

We need to find a solution to stop appearing the pop-up warning so that
users don’t have to respond to the warning message.


Dilum

unread,
Aug 10, 2007, 12:12:01 AM8/10/07
to

Jocelyn Fiorello [MVP - Outlook]

unread,
Aug 10, 2007, 12:36:01 AM8/10/07
to
See if the information on the following page helps:

http://www.slipstick.com/outlook/esecup.htm#autosec

--
Jocelyn Fiorello
MVP - Outlook

*** Messages sent to my e-mail address will NOT be answered -- please reply
only to the newsgroup to preserve the message thread. ***

Dilum

unread,
Aug 10, 2007, 1:48:00 AM8/10/07
to
Hi Jocelyn,

Thank you very much for your quick response. This application runs in
standalone machines and therefore cannot use administrative options to
suppress the warning message.

This application is developed with .Net 1.1 and C#. Since Extended Mapi is
only available for C++ (and Delphi) developers and since my objective is to
simply convert a msg file to a text file, and also I’ve read in many places
where developers mention to get away of Eextended Mapi if possible due to the
complexity of the low level language, I thought of searching for other
solutions.

I’ve already come across those third party components such as Redemption and
Advanced Security but continued to search for more solutions to check whether
it is possible without using a third party component or by using an ideal
component which is available for free. But thank you so much for your kind
efforts for providing this information.

Best Regards,
Dilum

Sue Mosher [MVP-Outlook]

unread,
Aug 10, 2007, 10:00:04 AM8/10/07
to
All your options related to Outlook objects are outlined here: http://www.outlookcode.com/article.aspx?ID=52

However, recently an enterprising developer has hacked the .msg format to provide a way to access its data directly. See http://www.outlookcode.com/codedetail.aspx?id=1561

FYI, there is a newsgroup specifically for general Outlook programming issues "down the hall" at microsoft.public.outlook.program_vba or, via web interface, at http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.outlook.program_vba

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Dilum" <Di...@discussions.microsoft.com> wrote in message news:5B185D4C-563C-4E75...@microsoft.com...

Dilum

unread,
Aug 11, 2007, 2:44:01 AM8/11/07
to
Hi Sue,

Thank you very much for your quick response.

Best regards,
Dilum

Dilum

unread,
Aug 11, 2007, 3:14:01 AM8/11/07
to
Hello Sue,

Thank you very much for your help. I was also looking for solutions to
convert EML files (.eml) to text. From my research I found following options.

• Using CDO (Collaborative Data Objects ) API by Microsoft
• Using third-party components (Rebex, aspNetMime)
• By developing an API for manipulating EML files directly


Although I managed to use CDO in Windows XP environment where Microsoft
Exchange Server 2000 was not available, it is mainly developed to be used
with Windows 2000 environments. So it makes me uncomfortable to release the
component that uses CDO for the customers.

Also the small test project I did showed that CDO is not 100% accurate for
manipulating EML files. It didn’t return important information such as the
sender’s address and the date it returned was also incorrect.

Third party components were working fine, but I am still looking whether
it’s possible without using third party libraries because they are very
expensive.

Since the message structure of EML type is fairly simple processing it
directly would be another solution.

Can you please tell me if there are any other ways to convert EML files to
text files?

Best regards,
Dilum

John Blessing

unread,
Aug 11, 2007, 4:59:51 AM8/11/07
to
"Dilum" <Di...@discussions.microsoft.com> wrote in message
news:4F40C3EE-6F52-42A3...@microsoft.com...

> Hello Sue,
>
> Thank you very much for your help. I was also looking for solutions to
> convert EML files (.eml) to text. From my research I found following
> options.
>
> . Using CDO (Collaborative Data Objects ) API by Microsoft
> . Using third-party components (Rebex, aspNetMime)
> . By developing an API for manipulating EML files directly

>
>
> Although I managed to use CDO in Windows XP environment where Microsoft
> Exchange Server 2000 was not available, it is mainly developed to be used
> with Windows 2000 environments. So it makes me uncomfortable to release
> the
> component that uses CDO for the customers.
>
> Also the small test project I did showed that CDO is not 100% accurate for
> manipulating EML files. It didn't return important information such as the
> sender's address and the date it returned was also incorrect.
>
> Third party components were working fine, but I am still looking whether
> it's possible without using third party libraries because they are very
> expensive.
>
> Since the message structure of EML type is fairly simple processing it
> directly would be another solution.
>
> Can you please tell me if there are any other ways to convert EML files to
> text files?
>
> Best regards,
> Dilum
>

PMFJI, if you want free and you don't want to change your code, I suggest
you try:

http://www.contextmagic.com/express-clickyes/


You can even call this from your program before you get to the bit of code
that accesses Outlook, do your stuff, let it click the Allow button for you
automatically, then close it down from your code.


--
John Blessing

http://www.LbeHelpdesk.com - Help Desk software priced to suit all
businesses
http://www.room-booking-software.com - Schedule rooms & equipment bookings
for your meeting/class over the web.
http://www.lbetoolbox.com - Remove Duplicates from MS Outlook, find/replace,
send newsletters


Sue Mosher [MVP-Outlook]

unread,
Aug 11, 2007, 8:00:15 AM8/11/07
to
Every .eml file I've ever looked at *is* a text file. Sorry, but since .eml files have nothing to do with Outlook programming, I don't know anything more about conversion methods other than what you can do with Outlook Redemption. A messaging forum or a general Windows programming forum might be a better place to ask about this.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Dilum" <Di...@discussions.microsoft.com> wrote in message news:4F40C3EE-6F52-42A3...@microsoft.com...

Dilum

unread,
Aug 13, 2007, 4:50:01 AM8/13/07
to
Hi Sue,

Thank you very much for your support.

Best regards,
Dilum

"Sue Mosher [MVP-Outlook]" wrote:

> Every .eml file I've ever looked at *is* a text file. Sorry, but since ..eml files have nothing to do with Outlook programming, I don't know anything more about conversion methods other than what you can do with Outlook Redemption. A messaging forum or a general Windows programming forum might be a better place to ask about this.

0 new messages