Using: Visual Studio 2017 (Language: C#)
I have a similar function written below in PowerShell script, but I need the C# version of it to execute on the click of a button within Visual Studio:
Add-type -assembly "Microsoft.Office.Interop.Outlook" | out-null
$outlook = new-object -comobject outlook.application
$namespace = $outlook.GetNameSpace("MAPI")
dir “$env:userprofile\Documents\Outlook Files\*.pst” | % { $namespace.AddStore($_.FullName) }
Any insight or examples of code would be much appreciated.