First live build against real Visual Studio/VSTO tooling surfaced two issues in the hand-written AddIn scaffold: ThisAddIn derived from the wrong base type (OutlookAddIn is an interface, not the concrete OutlookAddInBase class), and VSTO Application projects cannot build without a signed ClickOnce manifest, so SignManifests is now on with a throwaway self-signed test certificate. Both Core/Core.Tests/AddIn now build clean and Core.Tests passes. Also: mail always sent from Outlook's default account with no way to pick a different one (e.g. a shared mailbox) - added a "From account" setting (Session.Accounts dropdown in SettingsForm, SendUsingAccount in MailSender). And added deploy/ with both a local ClickOnce publish script (real install/uninstall via Windows Apps, no manual registry editing) and a manual registry sideload fallback for scripted rollouts. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
48 lines
1.8 KiB
C#
48 lines
1.8 KiB
C#
using System;
|
|
using Office = Microsoft.Office.Core;
|
|
using Outlook = Microsoft.Office.Interop.Outlook;
|
|
|
|
namespace BulkArchiveMailer.AddIn
|
|
{
|
|
public partial class ThisAddIn
|
|
{
|
|
/// <summary>Convenience alias for the inherited Application property, so RibbonController/forms don't need to know the base class's exact property name.</summary>
|
|
internal Outlook.Application OutlookApplication => this.Application;
|
|
|
|
private void ThisAddIn_Startup(object sender, EventArgs e)
|
|
{
|
|
// Deliberately does nothing eagerly: no settings/folder/registry
|
|
// access happens until the operator clicks the ribbon button,
|
|
// so add-in load never slows down or blocks Outlook startup.
|
|
}
|
|
|
|
private void ThisAddIn_Shutdown(object sender, EventArgs e)
|
|
{
|
|
// Outlook typically no longer raises this reliably before
|
|
// process exit; nothing here needs cleanup anyway (no open
|
|
// handles/timers are kept alive between ribbon clicks).
|
|
}
|
|
|
|
/// <summary>Wires up RibbonController (raw Ribbon XML + callbacks, see Ribbon.xml) as this add-in's ribbon UI.</summary>
|
|
protected override Office.IRibbonExtensibility CreateRibbonExtensibilityObject()
|
|
{
|
|
return new RibbonController();
|
|
}
|
|
|
|
#region VSTO generated code
|
|
|
|
/// <summary>
|
|
/// Required method for Designer support - do not modify the
|
|
/// contents of this method with the code editor. Called from
|
|
/// ThisAddIn.Designer.cs's FinishInitialization() override.
|
|
/// </summary>
|
|
private void InternalStartup()
|
|
{
|
|
this.Startup += new EventHandler(ThisAddIn_Startup);
|
|
this.Shutdown += new EventHandler(ThisAddIn_Shutdown);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|