MicrosoftGraphMailboxOptions.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. namespace OASystem.API.OAMethodLib.MicrosoftGraphMailbox;
  2. /// <summary>
  3. /// Microsoft Graph 邮箱轮询(公共客户端 MSAL + 交互式首次登录)配置。
  4. /// </summary>
  5. public class MicrosoftGraphMailboxOptions
  6. {
  7. public const string SectionName = "MicrosoftGraphMailbox";
  8. /// <summary>
  9. /// 是否启用后台收件箱轮询。关闭时不初始化 MSAL、不弹浏览器。
  10. /// </summary>
  11. public bool Enabled { get; set; }
  12. /// <summary>
  13. /// Azure AD 应用程序(公共客户端)ID。
  14. /// </summary>
  15. public string ClientId { get; set; } = string.Empty;
  16. /// <summary>
  17. /// 租户,例如 common、organizations 或具体租户 GUID。
  18. /// </summary>
  19. public string Tenant { get; set; } = "common";
  20. /// <summary>
  21. /// 须在 Azure 门户中注册的公共客户端重定向 URI(与交互式登录一致)。
  22. /// </summary>
  23. public string RedirectUri { get; set; } = "http://localhost:55649";
  24. /// <summary>
  25. /// 轮询间隔(秒)。
  26. /// </summary>
  27. public int PollIntervalSeconds { get; set; } = 30;
  28. /// <summary>
  29. /// 每次拉取的邮件条数上限。
  30. /// </summary>
  31. public int TopMessages { get; set; } = 50;
  32. /// <summary>
  33. /// MSAL 令牌缓存目录;为空则使用 %LocalAppData%\OASystem\MicrosoftGraphMailbox。
  34. /// </summary>
  35. public string? CacheDirectory { get; set; }
  36. /// <summary>
  37. /// 令牌缓存文件名。
  38. /// </summary>
  39. public string CacheFileName { get; set; } = "msal_graph_mailbox_cache.bin";
  40. /// <summary>
  41. /// 启动并成功取 token 后是否调用 /me 打一条日志(便于确认账号)。
  42. /// </summary>
  43. public bool LogProfileOnStartup { get; set; } = true;
  44. /// <summary>
  45. /// 无新邮件时是否仍输出轮询心跳日志。
  46. /// </summary>
  47. public bool LogEachPollWhenEmpty { get; set; }
  48. }