【发布时间】:2015-12-20 10:36:22
【问题描述】:
我使用 Visual Studio 2013 和 Add-in express v.7.7.4087 开发了一个 Outlook 插件。 我必须处理多个电子邮件帐户(商店)。请看下面的截图和代码
private void timerSendFromDraftsFolder_Tick(object sender, EventArgs e)
{
Outlook.Stores stores = null; // CC and OL accounts,
Outlook.Store store = null;
Outlook.MAPIFolder rootFolder = null;
Outlook.Folders rootFolderFolders = null;
Outlook.MAPIFolder draftsFolder = null;
Outlook.Items items = null;
Outlook.MailItem mailItem = null;
bool itemSent = true;
bool allMailItemsSent = true;
try
{
if (Helper.IsOnline())
{
Debug.DebugMessage(3, "AddinModule : timerSendFromSaleswingsFolder_Tick : Fired");
string version = OutlookApp.Version;
if (String.Compare(version, "13") > 0)
{
stores = Globals.ObjNS.Stores;
for (int i = 1; i <= stores.Count; i++)
{
try
{
store = stores[i];
string storeName = store.DisplayName;
if (store.ExchangeStoreType != Outlook.OlExchangeStoreType.olExchangePublicFolder)
{
rootFolder = store.GetRootFolder();
rootFolderFolders = rootFolder.Folders;
if (rootFolderFolders != null)
{
try
{
draftsFolder = rootFolderFolders["drafts"]; // not working for "xxxxxxx@outlook.com" type email accounts
}
catch (Exception )
{
Debug.DebugMessage(3, "AddinModule : timerSendFromSaleswingsFolder_Tick : Excep");
draftsFolder = rootFolderFolders["Drafts (This computer only)"];
}
}
我需要访问每个邮件帐户的草稿文件夹,但“xxxxxxx@outlook.com”的电子邮件帐户显示草稿文件夹为“草稿(仅限此计算机)” 而不是 “草稿”。
我工作得很好。但我不喜欢将此引入生产版本。因为我认为这不适用于非英语环境。
你能建议我解决这个问题吗
作为救赎 (http://www.dimastr.com/redemption/home.htm),有解决方案吗?
附言
我在一些项目中使用过这段代码
oFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDrafts);
但它提供了主邮件帐户的草稿文件夹。在我的代码中,这里没有“store”对象的这种方法。
【问题讨论】:
标签: c# email outlook outlook-addin outlook-redemption