我需要從我的Outlook加載項(c#+ vsto)調用Outlook的對話清理。 我在辦公室的色帶欄上有我的按鈕,然後點擊它,它需要調用當前選定郵件項目的Outlook對話清理。 這是可能的,以及如何去做?從Outlook加載項調用對話清理
0
A
回答
0
Outlook項目提供了GetConversation方法,該方法獲取代表該項目所屬對話的Conversation
對象。
GetConversation
返回Null
(在Visual Basic中爲Nothing)如果該對象不存在對話。在下列情況下沒有對象存在對話:
•該項目尚未保存。項目可以以編程方式保存,也可以通過用戶操作或自動保存保存。
•對於可發送的項目(例如,郵件項目,預約項目或聯繫人項目),該項目尚未發送。
•會話已通過Windows註冊表禁用。
•商店不支持「對話」視圖(例如,Outlook對比早於Microsoft Exchange Server 2010的Microsoft Exchange版本以經典聯機模式運行)。使用Store對象的IsConversationEnabled屬性來確定商店是否支持對話視圖。
以下代碼示例假定瀏覽器窗口中的選定項目是郵件項目。代碼示例獲取與選定郵件項目關聯的對話,並枚舉該對話中的每個項目,顯示該項目的主題。 DemoConversation
方法調用所選郵件項目的GetConversation
方法以獲取關聯的對話對象。 DemoConversation
然後分別調用Conversation對象的GetTable
和GetRootItems
方法分別獲取Table對象和SimpleItems集合。
void DemoConversation()
{
object selectedItem =
Application.ActiveExplorer().Selection[1];
// This example uses only
// MailItem. Other item types such as
// MeetingItem and PostItem can participate
// in the conversation.
if (selectedItem is Outlook.MailItem)
{
// Cast selectedItem to MailItem.
Outlook.MailItem mailItem =
selectedItem as Outlook.MailItem;
// Determine the store of the mail item.
Outlook.Folder folder = mailItem.Parent as Outlook.Folder;
Outlook.Store store = folder.Store;
if (store.IsConversationEnabled == true)
{
// Obtain a Conversation object.
Outlook.Conversation conv = mailItem.GetConversation();
// Check for null Conversation.
if (conv != null)
{
// Obtain Table that contains rows
// for each item in the conversation.
Outlook.Table table = conv.GetTable();
Debug.WriteLine("Conversation Items Count: " +
table.GetRowCount().ToString());
Debug.WriteLine("Conversation Items from Table:");
while (!table.EndOfTable)
{
Outlook.Row nextRow = table.GetNextRow();
Debug.WriteLine(nextRow["Subject"]
+ " Modified: "
+ nextRow["LastModificationTime"]);
}
Debug.WriteLine("Conversation Items from Root:");
// Obtain root items and enumerate the conversation.
Outlook.SimpleItems simpleItems
= conv.GetRootItems();
foreach (object item in simpleItems)
{
// In this example, only enumerate MailItem type.
// Other types such as PostItem or MeetingItem
// can appear in the conversation.
if (item is Outlook.MailItem)
{
Outlook.MailItem mail = item
as Outlook.MailItem;
Outlook.Folder inFolder =
mail.Parent as Outlook.Folder;
string msg = mail.Subject
+ " in folder " + inFolder.Name;
Debug.WriteLine(msg);
}
// Call EnumerateConversation
// to access child nodes of root items.
EnumerateConversation(item, conv);
}
}
}
}
}
void EnumerateConversation(object item,
Outlook.Conversation conversation)
{
Outlook.SimpleItems items =
conversation.GetChildren(item);
if (items.Count > 0)
{
foreach (object myItem in items)
{
// In this example, only enumerate MailItem type.
// Other types such as PostItem or MeetingItem
// can appear in the conversation.
if (myItem is Outlook.MailItem)
{
Outlook.MailItem mailItem =
myItem as Outlook.MailItem;
Outlook.Folder inFolder =
mailItem.Parent as Outlook.Folder;
string msg = mailItem.Subject
+ " in folder " + inFolder.Name;
Debug.WriteLine(msg);
}
// Continue recursion.
EnumerateConversation(myItem, conversation);
}
}
}
相關問題
- 1. 在對話視圖中更改Outlook中的mailitem選項從c#outlook加載項
- 2. 的Outlook 2016加載項對話框上的「加載」掛
- 3. 從Outlook加載項中的對話框API重定向
- 4. Outlook加載項+ WPF
- 5. Outlook 2007加載項
- 6. 從outlook加載項調用crm web服務
- 7. Outlook JS加載項 - 處理對象保存
- 8. Outlook加載項代理對日曆的訪問
- 9. Outlook對象模型 - 掛鉤的談話清理功能
- 10. 如何從Plone網站清理未使用的加載項?
- 11. 加載Outlook加載項時出錯
- 12. Outlook加載項工具api
- 13. 缺少Outlook 2013加載項
- 14. Outlook加載項saveAsync在OWA
- 15. 安裝Outlook加載項
- 16. outlook加載項未翻譯
- 17. COM加載項,Outlook,ItemSend
- 18. Outlook加載項教程?
- 19. 如何清理Visual Studio工具(VSTO)2010 Outlook加載項後完成
- 20. 從VBA調用COM加載項選項
- 21. Outlook加載項:使用線程
- 22. 使用.NET的Outlook加載項
- 23. 使用Wix部署Outlook加載項
- 24. 爲Outlook 2010加載項禁用DEP
- 25. Outlook加載項。如何管理項目事件
- 26. Outlook 2003 vsto加載項分類對話框在新郵件窗口後打開
- 27. 從Outlook加載項調用時,NLog不會寫入日誌文件
- 28. Office.js:Mac的Outlook加載項 - 自定義屬性不會保存在我的Outlook加載項(Office.js)現有對象
- 29. Outlook加載項,減慢outlook的用戶界面
- 30. 從Office加載項調用進程?
尤金,感謝您回覆我的問題。爲了使用上述方法,我們必須將每個消息體與表中所有其他消息的主體進行比較。除此之外,我發現Outlook有不同情況下的正文文本(在某些郵件正文中有'mailto:',而電子郵件地址被'['括號括起來,而其他地方使用'<'括號「,在某些地方秒數存在於時間字段)。因此,只調用Outlook的內置對話清除功能可能會更好,而不是重新發明輪子。 –