2016-03-15 33 views
1

我正在尋找一種方法來閱讀和使用Outlook 2013中的快速步驟,但是我無法在該語言的文檔中找到任何內容。 Here's我的代碼至今:在ASP.NET 2013中閱讀和使用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 = "[email protected]"; 
      String ccEmail = "[email protected]"; 
      //String bccEmail = ""; 
      String subjectEmail = "using Outlook 2013"; 
      String body = "body"; 

      OutlookApp appDoOutlook = new OutlookApp(); 
      livingTheFantasy.MailItem itemDoMail = appDoOutlook.CreateItem(livingTheFantasy.OlItemType.olMailItem); 
      string accName = "[email protected]"; 
      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); 
     } 
    } 
} 

回答

0

簡單的步驟存儲在名爲「快速步驟設置」在同一水平作爲你的收件箱和其他默認文件夾的文件夾無形的相關目錄。如果您轉到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版本)。

+0

我不能使用第三方軟件。第一個解決方案在這裏沒有工作。 –

+0

哪個解決方案不起作用? –

+0

這裏沒有2個解決方案? –

0

感謝您的幫助,我在HTML中創建模型並將其導入到asp.net中。