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>
69 lines
3.4 KiB
C#
69 lines
3.4 KiB
C#
namespace BulkArchiveMailer.AddIn
|
|
{
|
|
/// <summary>
|
|
/// Designer-generated half of ThisAddIn. Normally Visual Studio's VSTO
|
|
/// project system regenerates this file automatically from
|
|
/// ThisAddIn.Designer.xml the first time the project is opened/edited
|
|
/// in the IDE (host-item "blueprint" mechanism) - it is hand-written
|
|
/// here only because this environment had no VSTO tooling to run that
|
|
/// generator, and later corrected to match the real base class after
|
|
/// the first build against the actual VSTO assemblies (see git log).
|
|
///
|
|
/// The real base class is NOT the <c>Microsoft.Office.Tools.Outlook.OutlookAddIn</c>
|
|
/// interface (that only declares the FormRegion-related members) but
|
|
/// <c>Microsoft.Office.Tools.Outlook.OutlookAddInBase</c> - a concrete
|
|
/// abstract class living in Microsoft.Office.Tools.Outlook.v4.0.Utilities.dll
|
|
/// (referenced with SpecificVersion=False/Private=True in the .csproj,
|
|
/// same as the built-in "Outlook VSTO Add-in" project template), which
|
|
/// itself derives from Microsoft.Office.Tools.AddInBase and already
|
|
/// implements OutlookAddIn/AddIn/IBindableComponent/IComponent/
|
|
/// IDisposable, plus exposes the protected virtual
|
|
/// CreateRibbonExtensibilityObject() overridden in ThisAddIn.cs.
|
|
///
|
|
/// Do not hand-edit once opened in VS if the IDE regenerates it
|
|
/// differently.
|
|
/// </summary>
|
|
[Microsoft.VisualStudio.Tools.Applications.Runtime.StartupObjectAttribute(0)]
|
|
[global::System.Security.Permissions.PermissionSetAttribute(global::System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
|
|
public sealed partial class ThisAddIn : Microsoft.Office.Tools.Outlook.OutlookAddInBase
|
|
{
|
|
/// <summary>Populated from the host item in <see cref="Initialize"/>; exposed to the rest of the add-in via the OutlookApplication alias in ThisAddIn.cs.</summary>
|
|
internal Microsoft.Office.Interop.Outlook.Application Application;
|
|
|
|
/// <summary>
|
|
/// Required constructor for VSTO add-in support - do not modify
|
|
/// the contents of this method with the code editor. The VSTO
|
|
/// runtime instantiates ThisAddIn through this constructor via
|
|
/// reflection (see the StartupObjectAttribute above).
|
|
/// </summary>
|
|
public ThisAddIn(Microsoft.Office.Tools.Outlook.Factory factory, System.IServiceProvider serviceProvider)
|
|
: base(factory, serviceProvider, "AddIn", "ThisAddIn")
|
|
{
|
|
Globals.Factory = factory;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Required method for Designer support - do not modify the
|
|
/// contents of this method with the code editor.
|
|
/// </summary>
|
|
protected override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
this.Application = this.GetHostItem<Microsoft.Office.Interop.Outlook.Application>(
|
|
typeof(Microsoft.Office.Interop.Outlook.Application), "Application");
|
|
Globals.ThisAddIn = this;
|
|
global::System.Windows.Forms.Application.EnableVisualStyles();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Required method for Designer support - do not modify the
|
|
/// contents of this method with the code editor.
|
|
/// </summary>
|
|
protected override void FinishInitialization()
|
|
{
|
|
this.InternalStartup();
|
|
this.OnStartup();
|
|
}
|
|
}
|
|
}
|