Simple console application to output a hierarchy of Outlook folders, with their Entry ID, using NetOffice.
<?xml version="1.0" encoding="utf-8"?> | |
<packages> | |
<package id="NetOffice.Core" version="1.7.3.0" targetFramework="net461" /> | |
<package id="NetOffice.Outlook" version="1.7.3.0" targetFramework="net461" /> | |
</packages> |
using System; | |
namespace OutlookFolderIdGrabber | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
using (var application = new NetOffice.OutlookApi.Application()) | |
{ | |
DisplayFolder(application.Session.DefaultStore.GetRootFolder()); | |
} | |
} | |
private static void DisplayFolder(NetOffice.OutlookApi.MAPIFolder folder, int level = 0) | |
{ | |
Console.WriteLine($"{new string(' ', level)}{folder.Name} : {folder.EntryID}"); | |
foreach (NetOffice.OutlookApi.MAPIFolder childFolder in folder.Folders) | |
{ | |
DisplayFolder(childFolder, level + 1); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment