简体   繁体   English

在Outlook中使用C#读取和还原其他邮箱列表

[英]Read and Restore additional mailboxes list using C# in Outlook

Is it possible to read "additional mailboxes" list using C# Outlook API? 是否可以使用C#Outlook API阅读“其他邮箱”列表?

The list is placed in following window in outlook: 该列表位于Outlook中的以下窗口中:

Tools > Account Settings > Email > Select Account > Change... > On the 'Microsoft Exchange Server Settings' tab, select 'More Settings ...' On the 'Microsoft Exchange Server', add the additional mailbox select the 'Advanced' tab. 工具>帐户设置>电子邮件>选择帐户>更改...>在“ Microsoft Exchange Server设置”选项卡上,选择“更多设置...”在“ Microsoft Exchange Server”上,添加其他邮箱,选择“高级”标签。 Here in this tab, all additional mailboxes are listed in a listbox under 'Open these additional mailboxes' label. 在此选项卡的此处,所有其他邮箱都在“打开这些其他邮箱”标签下的列表框中列出。

I have to to backup and restore this list using C# Code. 我必须使用C#代码备份和还原此列表。

Can I do that using Outlook Interop libraries? 我可以使用Outlook Interop库吗?

Thanks in advance for your answers. 预先感谢您的回答。

You can access additional shared mailboxes by using Session.Stores ( Outlook Interop ). 您可以使用Session.StoresOutlook Interop )访问其他共享邮箱。 See this related SO post which contains an example code snippet. 请参阅此相关的SO帖子 ,其中包含示例代码段。

I found the way to read all mailboxes: Here is the code example: 我找到了读取所有邮箱的方法:这是代码示例:

using System;
using Microsoft.Office.Interop.Outlook;

class Program
{
    static void Main(string[] args)
    {
        var oApp = new Application();

        var oNS = oApp.GetNamespace("MAPI");

        Stores stores = oNS.Stores;

        foreach (Store store in stores)
        {
            Console.WriteLine("Name: {0} \n Path: {1} \n Type: {2} \n IsDataFileStore: {3}", 
                                store.DisplayName, store.FilePath, store.ExchangeStoreType, store.IsDataFileStore);

            Console.WriteLine(Environment.NewLine);
        }

        Console.WriteLine("Done");
        Console.ReadKey();
    }
}

The new question is how can I restore those mailbox using C#? 新问题是如何使用C#还原那些邮箱? :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM