Skip to content

Commit

Permalink
Added "set helpdesk email on install". Still need to finish cmdline p…
Browse files Browse the repository at this point in the history
…assing.
  • Loading branch information
agreenbhm committed May 20, 2016
1 parent 938a323 commit 1c04fa3
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ForwardToSpiceworks.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,27 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{49DB6B29-F42A-49F5-AAE4-7927FF8B7D60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{49DB6B29-F42A-49F5-AAE4-7927FF8B7D60}.Debug|Any CPU.Build.0 = Debug|Any CPU
{49DB6B29-F42A-49F5-AAE4-7927FF8B7D60}.Debug|x86.ActiveCfg = Debug|x86
{49DB6B29-F42A-49F5-AAE4-7927FF8B7D60}.Debug|x86.Build.0 = Debug|x86
{49DB6B29-F42A-49F5-AAE4-7927FF8B7D60}.Release|Any CPU.ActiveCfg = Release|Any CPU
{49DB6B29-F42A-49F5-AAE4-7927FF8B7D60}.Release|Any CPU.Build.0 = Release|Any CPU
{49DB6B29-F42A-49F5-AAE4-7927FF8B7D60}.Release|Any CPU.Deploy.0 = Release|Any CPU
{49DB6B29-F42A-49F5-AAE4-7927FF8B7D60}.Release|x86.ActiveCfg = Release|x86
{49DB6B29-F42A-49F5-AAE4-7927FF8B7D60}.Release|x86.Build.0 = Release|x86
{1F0285A6-EAAB-4F13-962E-91575B19521D}.Debug|Any CPU.ActiveCfg = Debug
{1F0285A6-EAAB-4F13-962E-91575B19521D}.Debug|x86.ActiveCfg = Debug
{1F0285A6-EAAB-4F13-962E-91575B19521D}.Debug|x86.Build.0 = Debug
{1F0285A6-EAAB-4F13-962E-91575B19521D}.Release|Any CPU.ActiveCfg = Release
{1F0285A6-EAAB-4F13-962E-91575B19521D}.Release|Any CPU.Build.0 = Release
{1F0285A6-EAAB-4F13-962E-91575B19521D}.Release|x86.ActiveCfg = Release
{1F0285A6-EAAB-4F13-962E-91575B19521D}.Release|x86.Build.0 = Release
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
20 changes: 20 additions & 0 deletions OutlookAddIn1/ForwardToSpiceworks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
Expand Down Expand Up @@ -189,6 +190,9 @@
<Compile Include="Assign.Designer.cs">
<DependentUpon>Assign.cs</DependentUpon>
</Compile>
<Compile Include="InstallerHelper.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Logic.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
Expand Down Expand Up @@ -273,6 +277,22 @@
<PropertyGroup>
<ManifestCertificateThumbprint>74E86B2D64A88A49C3DAEC172CD6E175650FE8FE</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>VSTO40;DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>VSTO40;TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<!-- Include the build rules for a C# project. -->
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- Include additional build rules for an Office application add-in. -->
Expand Down
39 changes: 39 additions & 0 deletions OutlookAddIn1/InstallerHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration.Install;
using System.Collections;
using Microsoft.Win32;
using System.ComponentModel;
using System.Windows.Forms;

namespace OutlookAddIn1
{
[RunInstaller(true)]
public class MyInstallerClass : Installer
{
public MyInstallerClass() : base()
{

}

public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
string helpdeskEmail = Context.Parameters["HelpdeskEmail"];
//Properties.Settings.Default.HelpdeskEmail = Context.Parameters["HelpdeskEmail"];
//Properties.Settings.Default.Save();
//MessageBox.Show(Context.Parameters["HelpdeskEmail"], "Custom Action Debug", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
RegistryKey key = Registry.LocalMachine.CreateSubKey("Software\\Microsoft\\Office\\Outlook\\Addins\\DrewGreen.net.SpiceworksOutlookAddIn");
if (key != null)
{
key.SetValue("HelpdeskEmail", helpdeskEmail);
key.Close();
}

}
}
}

27 changes: 27 additions & 0 deletions OutlookAddIn1/ThisAddIn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,33 @@ private void ThisAddIn_Startup(object sender, System.EventArgs e)

Globals.Ribbons.RibbonRead.hideButtons(installType);
Globals.Ribbons.RibbonMain.hideButtons(installType);

if (Properties.Settings.Default.HelpdeskEmail == "" || Properties.Settings.Default.HelpdeskEmail == null)
{
try
{
string helpdeskEmail = "";
RegistryKey key = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Office\\Outlook\\Addins\\DrewGreen.net.SpiceworksOutlookAddIn");
if(key != null)
{
helpdeskEmail = (string)key.GetValue("HelpdeskEmail");
}
else
{
key = Registry.LocalMachine.OpenSubKey("Software\\Wow6432Node\\Microsoft\\Office\\Outlook\\Addins\\DrewGreen.net.SpiceworksOutlookAddIn");
if (key != null)
{
helpdeskEmail = (string)key.GetValue("HelpdeskEmail");
}
}
if(helpdeskEmail != null)
{
Properties.Settings.Default.HelpdeskEmail = helpdeskEmail;
Properties.Settings.Default.Save();
}
}
catch { }
}
}

void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
Expand Down

0 comments on commit 1c04fa3

Please sign in to comment.