【问题标题】:Reading and using Quick Steps in Outlook 2013 with ASP.NET通过 ASP.NET 阅读和使用 Outlook 2013 中的快速步骤
【发布时间】:2016-07-01 01:30:44
【问题描述】:

我正在寻找一种方法来阅读和使用 Outlook 2013 中的快速步骤,但我在该语言的文档中找不到任何内容。 到目前为止,这是我的代码:

using livingTheFantasy = Microsoft.Office.Interop.Outlook;
using OutlookApp = Microsoft.Office.Interop.Outlook.Application;
namespace outlookPrimeiro
{
    public partial class _Default : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            String toEmail = "to@email.com";
            String ccEmail = "cc@email.com";
            //String bccEmail = "";
            String subjectEmail = "using Outlook 2013";
            String body = "body";

            OutlookApp appDoOutlook = new OutlookApp();
            livingTheFantasy.MailItem itemDoMail = appDoOutlook.CreateItem(livingTheFantasy.OlItemType.olMailItem);
            string accName = "from@email.com";
            livingTheFantasy.NameSpace sessao = itemDoMail.Session;
            livingTheFantasy.Accounts contaAccounts = sessao.Accounts;
            for (int i = 1; i <= contaAccounts.Count; i++)
            {
                livingTheFantasy.Account contaAccount = contaAccounts[i];
                if (contaAccount.DisplayName.ToLower() == accName.ToLower())
                {
                    itemDoMail.SendUsingAccount = contaAccount;
                    Marshal.ReleaseComObject(contaAccount);
                    break;
                }
            }
            itemDoMail.To = toEmail;
            itemDoMail.CC = ccEmail;
            //itemDoMail.BCC = bccEmail;
            itemDoMail.Subject = subjectEmail;
            itemDoMail.HTMLBody = body;
            itemDoMail.Importance = livingTheFantasy.OlImportance.olImportanceHigh;
            //itemDoMail.Send();
            itemDoMail.Display(false);
            Marshal.ReleaseComObject(contaAccounts);
            Marshal.ReleaseComObject(sessao);
        }
    }
}

【问题讨论】:

    标签: asp.net outlook ms-office exchange-server


    【解决方案1】:

    快速步骤存储在与您的收件箱和其他默认文件夹处于同一级别的称为“快速步骤设置”的不可见文件夹的关联目录中。如果您转到 Outlook 中的根文件夹(收件箱的父级)并单击 OutlookSpy 工具栏上的 IMAPIFolder 按钮,您可以看到 OutlookSpy 中的数据。转到 GetHierarchyTable,双击“快速步骤设置”文件夹,转到“关联目录”选项卡,您应该会看到几条“IPM.Microsoft.CustomAction”消息(每个快速步骤一条)。双击任何这些消息,找到 PR_ROAMING_XMLSTREAM 属性,单击“值”编辑框旁边的“...”按钮。

    如果使用Redemption 是一个选项,它会公开RDOQuickSteps 对象,该对象允许读取和修改Outlook 快速步骤(RDOQuickStep) 和their actions

     set Session = CreateObject("Redemption.RDOSession")
     Session.MAPIOBJECT = Application.Session.MAPIOBJECT
     set QuickSteps = Session.Stores.DefaultStore.QuickSteps
     for each QuickStep in QuickSteps
         Debug.Print "----------------"
         Debug.Print QuickStep.Name
     next
    

    另外请记住,Outlook 对象模型不能用于服务(例如 IIS)。您仍然可以在 Redemption 中使用 RDO 系列对象,因为它是基于扩展 MAPI 的),但您需要调用 RDOSession.Logon(如果您在配置了配置文件的本地用户下运行 IIS)或 RDOSession.LogonHostedExchangeMailbox /LogonExchangeMailbox(取决于 Exchange 版本)。

    【讨论】:

    • 我不能使用第三方软件。第一个解决方案在这里不起作用。
    • 这里没有2个解决方案?
    • 第一个建议是使用 OutlookSpy 查看数据的存储方式和位置,以满足您的好奇心。我唯一建议的是救赎。您可以使用 Outlook 对象模型获取快速步骤数据(但您只能读取一个快速步骤),但即便如此,OOM 也不能在服务中使用。
    【解决方案2】:

    感谢您的帮助,我在 HTML 中创建模型并将它们导入 asp.net。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-02-24
      • 1970-01-01
      • 2012-08-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-05
      相关资源
      最近更新 更多