protected void MyButton_Click(CommandBarButton cmdBarbutton,ref bool cancel)
{
System.Windows.Forms.MessageBox.Show("MyButton was Clicked","MyAddin1");
Outlook.Application objApp;
Outlook.NameSpace objNameSpace;
Outlook.MAPIFolder objMapiFolder;
Outlook.MailItem objMailitems;
try
{
objApp = new Outlook.Application();
objNameSpace = objApp.GetNamespace("MAPI"); // Wie im VBA Beispiel
objMapiFolder = objNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
//Holt sich den Standard E-Mail Folder Inbox
objMailitems = (Outlook.MailItemClass)objMapiFolder.Items; //ob das klappt wie gewollt?
// ab hier läuft es noch nicht...
//foreach (Outlook._MailItem mitem in objMailitems )
//{}
//objMailitem = Outlook.MailItem();
//objMailitem = new Outlook.MailItem();
}
catch( Exception theException )
{
String errorMessage;
errorMessage = "Error: ";
errorMessage = String.Concat( errorMessage, theException.Message );
errorMessage = String.Concat( errorMessage, " Line: " );
errorMessage = String.Concat( errorMessage, theException.Source );
//MessageBox.Show( errorMessage, "Error" );
}
}