DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Thu, 9 Aug 2007 20:46:05 -0700,    posted on: microsoft.public.dotnet.framework.interop        back       

Thread Index
  1    Dilum


Outlook security warning - A program is trying to access outlook   
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.
Date:Thu, 9 Aug 2007 20:46:05 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us