public int Run(AppContext context) { int exitCode = 0; try { outlook.Initialise(); if (outlook.TrySetStore(context.Config.StoreDescriptor)) { var store = outlook.GetCurrentStore(); logger.LogInformation("Name=\"{DisplayName}\",Path=\"{FilePath}\",Type={ExchangeStoreType}", store.DisplayName, store.FilePath, store.ExchangeStoreType); if (outlook.TrySetFolder()) { outlook.ProcessItem = ProcessItem; if (context.Config.WhatIf == false) { Directory.CreateDirectory(context.Config.TargetFolder); } outlook.ForEachAttachment(context); } } context.Stats.Show(); } catch (Exception ex) { logger.LogError(ex, "Failed to save Outlook attachments"); } return(exitCode); }
public int Run(AppContext context) { int exitCode = 0; try { outlook.Initialise(); foreach (var store in outlook.GetStores()) { Console.WriteLine("Name=\"{0}\",Path=\"{1}\",Type={2}", store.DisplayName, store.FilePath, store.ExchangeStoreType); } } catch (Exception ex) { logger.LogError(ex, "Failed to list Outlook stores"); } return(exitCode); }