Wie kann ich Formular "zu" ändern, wenn ich eine neue Mail (oder Antwort) in Outlook erstellen? MailItem.Sender und SendUsingAccount funktionieren nicht.C# wie Absender ändern Feld in Outlook
Namespace OutlookAddIn7 { public partial class ThisAddIn { Outlook.Inspectors Inspektoren;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
inspectors = this.Application.Inspectors;
inspectors.NewInspector +=
new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(SendUsingAccountExample);
}
void SendUsingAccountExample(Microsoft.Office.Interop.Outlook.Inspector Inspector)
{
Outlook.MailItem mailItem = Inspector.CurrentItem as Outlook.MailItem;
Outlook.NameSpace session = mailItem.Session;
Outlook.Accounts accounts = session.Accounts;
mailItem.SendUsingAccount = Application.Session.Accounts[1];
//mailItem.Sender = accounts[1].CurrentUser.AddressEntry;
//Microsoft.Office.Interop.Outlook.Recipient recipient = Application.Session.CreateRecipient(accounts[1].CurrentUser.AddressEntry.Address);
}
Willkommen bei Stack Overflow! Um Ihnen eine gute Antwort zu geben, könnte es uns helfen, wenn Sie einen Blick auf [fragen] haben, falls Sie das nicht bereits getan haben. – Mat
Ändern Sie das Standardkonto von Outlook in das Konto, das Sie senden möchten. So müssen Sie es nicht programmgesteuert ändern. – Gokul