[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Outlook security warning - A program is trying to access outlook

Dilum

8/10/2007 3:46:00 AM

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.


2 Answers

FLO

9/4/2007 9:59:00 AM

0

Hello Dilum,

Take a look at "Outlook Redemption".
It allows to access the Outlook object modell without displaying the
pop-up-warnings.
We use it to send newsletters and it is working fine.

Otherwise you probably have to find a way to access the text contents
without using the Outlook Interops.
Maybe access directly the .pst-files?

Florian

Dilum schrieb:
> 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

9/4/2007 10:22:00 AM

0

Hi Flo,
Thank you so much for the information.

Best Regards,
Dilum

"FLO" wrote:

> Hello Dilum,
>
> Take a look at "Outlook Redemption".
> It allows to access the Outlook object modell without displaying the
> pop-up-warnings.
> We use it to send newsletters and it is working fine.
>
> Otherwise you probably have to find a way to access the text contents
> without using the Outlook Interops.
> Maybe access directly the .pst-files?
>
> Florian
>
> Dilum schrieb:
> > 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.
> >
> >
>