1
Das Code-Fragment Speicher gibt mir ein "COMException
", wenn die LeitungOutlook-Addin wirft COMException, wenn eine E-Mail
>mail.SaveAs(@"C:\Users\Michalczak\Desktop");
erreicht ist. Das Ereignis wird ordnungsgemäß ausgelöst und löst den Ereignishandler aus.
>InboxFolder_ItemAdd(object o)
Die Exception-Nachricht, die in der catch-Block geworfen wird, ist so etwas wie:
> You do not have permission to perform this operation.
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
myTestInBox = (Outlook.Folder)this.Application.Session.GetDefaultFolder
(Outlook.OlDefaultFolders.olFolderInbox);
stor.inBox = myTestInBox.Items;
stor.inBox.ItemAdd +=
new Outlook.ItemsEvents_ItemAddEventHandler
(InboxFolder_ItemAdd);
}
private void InboxFolder_ItemAdd(object o)
{
Outlook.MailItem mail = null;
if (o != null && o is Outlook.MailItem)
{
mail = (Outlook.MailItem)o;
}
try
{
mail.SaveAs(@"C:\Users\Michalczak\Desktop");
}
catch (System.Runtime.InteropServices.COMException ce)
{
MessageBox.Show(ce.Source);
MessageBox.Show(ce.Message);
}
}
Ja das ist es! Danke :) – Zermatzor