Add project files.
This commit is contained in:
1 parent
1492edd472
commit
1c71c22df7
3 files changed
+75
No files matched your search
@@ -0,0 +1,25 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<PublishAot>true</PublishAot>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<COMReference Include="Microsoft.Office.Interop.Outlook">
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<VersionMinor>6</VersionMinor>
|
||||
<VersionMajor>9</VersionMajor>
|
||||
<Guid>00062fff-0000-0000-c000-000000000046</Guid>
|
||||
<Lcid>0</Lcid>
|
||||
<Isolated>false</Isolated>
|
||||
<EmbedInteropTypes>true</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.7.34024.191
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OutlookEmailListener", "OutlookEmailListener.csproj", "{60CA6935-828C-4DEC-B53E-4EB8901A6E6E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{60CA6935-828C-4DEC-B53E-4EB8901A6E6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{60CA6935-828C-4DEC-B53E-4EB8901A6E6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{60CA6935-828C-4DEC-B53E-4EB8901A6E6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{60CA6935-828C-4DEC-B53E-4EB8901A6E6E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {0039364C-28A1-465F-803B-F4D57B077D44}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
namespace OutlookEmailListener;
|
||||
|
||||
using Outlook = Microsoft.Office.Interop.Outlook;
|
||||
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Outlook.Application outlookApp = new Outlook.Application();
|
||||
Outlook.MAPIFolder inbox = outlookApp.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
|
||||
Outlook.Items items = inbox.Items;
|
||||
items.ItemAdd += new Outlook.ItemsEvents_ItemAddEventHandler(OnNewMail);
|
||||
|
||||
Console.WriteLine("Press any key to exit...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
|
||||
private static void OnNewMail(object item)
|
||||
{
|
||||
if (item is Outlook.MailItem mail)
|
||||
{
|
||||
Console.WriteLine("New mail received: {0}", mail.Subject);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user