PC Review


Reply
Thread Tools Rate Thread

Decrypt a mail with MailItem of Outlook and Certificates of VerSig

 
 
jonathan romero
Guest
Posts: n/a
 
      5th Feb 2010
Hi,
i have one a problem, i am develop a application who read a mail from
Exchange Server. my application using Primary Interop Assemblies (PIA) for
connect with Exchange Server to simulate a Outlook.
in this moment i can read all mail but when a read a mail with Digital ID
my application send a exeption and do not achieve download he attachment.

i put my code.
if someone can help me
thank you very much beforehand..

Outlook.Application oApp = new Outlook.Application();
Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
Outlook.MAPIFolder inBox =
oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
Outlook.Items inBoxItems = inBox.Items;
Outlook.MailItem newEmail = null;

inBoxItems = inBoxItems.Restrict("[Unread] = true");

try
{

foreach (object collectionItem in inBoxItems)
{
newEmail = collectionItem as Outlook.MailItem;

//In this section the application send a error
//I think in this section should decrypt a mail for download


if (newEmail != null )//&& from ==
"(E-Mail Removed)")
{
if(newEmail.Attachments.Count > 0)
{
for (int i = 1; i <= newEmail.Attachments.Count;
i++)
{

newEmail.Attachments[i].SaveAsFile(@"C:\WEBMAIN\" +
newEmail.Attachments[i].FileName);

//inBoxItems.Remove(newEmail.Attachments[i].Index);
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());

--------------------------------------------------------------------------------
Jonathan Romero
Especialista .Net

Profesional Microsoft VIP
DCE 3a Estrella


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening mail before outlook decrypt mail ramazan Microsoft Outlook Program Addins 0 2nd Sep 2008 11:53 AM
Re: decrypt problem: Length of the data to decrypt is invalid Oleg Subachev Microsoft C# .NET 4 21st Dec 2006 05:41 AM
Re: decrypt problem: Length of the data to decrypt is invalid Jon Skeet [C# MVP] Microsoft C# .NET 5 21st Dec 2006 01:12 AM
Re: decrypt problem: Length of the data to decrypt is invalid Robson Siqueira Microsoft C# .NET 1 19th Dec 2006 08:55 PM
Checking mail using Outlook MailItem and Exchange 2003 very slow Sam Tagney Microsoft Outlook Interoperability 0 26th Dec 2003 04:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:40 PM.