共用方式為


訂閱 RSS 摘要

此範例示範如何使用 OpenSharedFolder (String、Object、Object、Object) 方法訂閱 RSS 摘要。

範例

注意事項

下列程式代碼範例是 Microsoft Office Outlook 2007 程式設計應用程式的摘錄。

Outlook 物件模型支援提供共用數據的存取權,例如因特網行事曆、RSS 摘要,以及來自 Microsoft SharePoint 清單和文檔庫的數據。 它可連線到這些共享的數據源,並設定同步處理內容以繼續輪詢這些共用資源。 Outlook 物件模型提供 NameSpace 物件的 OpenSharedFolder (String、Object、Object、Object) 方法,以下載特定類型的共用資料夾並進行同步處理。

在下列範例中,AddRssFeed 會使用參考新 RSS 摘要的 URL 呼叫 OpenSharedFolder 方法,以訂閱名為“Example RSS Feed” 的新 RSS 摘要。 OpenSharedFolder 方法的最後兩個參數設定為 true,表示應該下載附件,而 Outlook 應該使用 RSS 摘要中提供的重新整理比例。

注意事項

您必須為 OpenSharedFolder 方法中的資料夾 URL 指定正確的通訊協定處理程式,才能訂閱 RSS 摘要。 例如,您必須使用開頭為 feed://https://網址,而不是 。 Outlook 無法開啟需要驗證的 RSS 摘要,除非 Windows NT LAN Manager (NTLM) 驗證可用,且無法從安全套接字層 (SSL) 位置載入 RSS 摘要。

If you use Visual Studio to test this code example, you must first add a reference to the Microsoft Outlook 15.0 Object Library component and specify the Outlook variable when you import the Microsoft.Office.Interop.Outlook namespace. The using statement must not occur directly before the functions in the code example but must be added before the public Class declaration. The following line of code shows how to do the import and assignment in C#.

using Outlook = Microsoft.Office.Interop.Outlook;
private void AddRssFeed()
{
    string feedUrl = "feed://example.org/rssfeed.xml";
    Outlook.Folder subscriptionFolder =
        Application.Session.OpenSharedFolder(feedUrl, "Example RSS Feed", true, true) as Outlook.Folder;
    Outlook.Explorer exp =
        Application.Explorers.Add(subscriptionFolder, Outlook.OlFolderDisplayMode.olFolderDisplayNormal);
    exp.Display();
}

另請參閱