在预览模式下启用 Outlook 插件

发布于 2025-01-10 13:19:32 字数 252 浏览 0 评论 0原文

我创建了一个扩展程序,可以提取电子邮件的一些参数并将其转发到我们的平台。它工作正常,但现在我想确保我的扩展即使在预览模式下也能工作。我们不必打开电子邮件即可使用扩展程序。 我找不到任何在预览模式下启用插件的配置。

输入图片此处描述

I have created an extension that extracts some parameters for the email and forwards it to our platform. It's working fine but now I want to make sure that my extension works even in preview mode. We don't have to open an email in order to use an extension.
I couldn't find any configuration to enable the plugin in preview mode.

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

简单气质女生网名 2025-01-17 13:19:32

看来您需要处理 Explorer 类的 SelectionChange 事件。当用户以编程方式或通过与用户界面交互选择不同或附加的 Microsoft Outlook 项目时,会触发该事件。当用户(以编程方式或通过用户界面)单击或切换到包含项目的其他文件夹时,也会发生此事件,因为 Outlook 会自动选择该文件夹中的第一个项目。但是,如果该文件夹是文件系统文件夹或者显示具有当前 Web 视图的任何文件夹,则不会发生此事件。

Public WithEvents myOlExp As Outlook.Explorer  
 
Public Sub Initialize_handler()  
 Set myOlExp = Application.ActiveExplorer  
End Sub 
 
Private Sub myOlExp_SelectionChange()  
 MsgBox myOlExp.Selection.Count & " items selected."  
End Sub

Explorer.Selection 属性返回 < code>Selection 对象,包含在资源管理器窗口中选择的一个或多个项目。以下是如何处理 Selection 对象的示例:

Sub GetSelectedItems() 
 Dim myOlExp As Outlook.Explorer 
 Dim myOlSel As Outlook.Selection
 Dim mySender As Outlook.AddressEntry 
 Dim oMail As Outlook.MailItem 
 Dim oAppt As Outlook.AppointmentItem 
 Dim oPA As Outlook.PropertyAccessor 
 Dim strSenderID As String 
 Const PR_SENT_REPRESENTING_ENTRYID As String = "http://schemas.microsoft.com/mapi/proptag/0x00410102"  
 Dim MsgTxt As String  
 Dim x As Long 
 
 MsgTxt = "Senders of selected items:"  
 Set myOlExp = Application.ActiveExplorer  
 Set myOlSel = myOlExp.Selection  
 For x = 1 To myOlSel.Count  
 If myOlSel.Item(x).Class = OlObjectClass.olMail Then  
 ' For mail item, use the SenderName property.  
 Set oMail = myOlSel.Item(x)  
 MsgTxt = MsgTxt & oMail.SenderName & ";"  
 ElseIf myOlSel.Item(x).Class = OlObjectClass.olAppointment Then  
 ' For appointment item, use the Organizer property.  
 Set oAppt = myOlSel.Item(x)  
 MsgTxt = MsgTxt & oAppt.Organizer & ";"  
 Else  
 ' For other items, use the property accessor to get the sender ID,  
 ' then get the address entry to display the sender name.  
 Set oPA = myOlSel.Item(x).PropertyAccessor  
 strSenderID = oPA.GetProperty(PR_SENT_REPRESENTING_ENTRYID)  
 Set mySender = Application.Session.GetAddressEntryFromID(strSenderID)  
 MsgTxt = MsgTxt & mySender.Name & ";"  
 End If  
 Next x  
 Debug.Print MsgTxt  
End Sub

It seems you need to handle the SelectionChange event of the Explorer class. It is fired when the user selects a different or additional Microsoft Outlook item programmatically or by interacting with the user interface. This event also occurs when the user (either programmatically or via the user interface) clicks or switches to a different folder that contains items, because Outlook automatically selects the first item in that folder. However, this event does not occur if the folder is a file-system folder or if any folder with a current Web view is displayed.

Public WithEvents myOlExp As Outlook.Explorer  
 
Public Sub Initialize_handler()  
 Set myOlExp = Application.ActiveExplorer  
End Sub 
 
Private Sub myOlExp_SelectionChange()  
 MsgBox myOlExp.Selection.Count & " items selected."  
End Sub

The Explorer.Selection property returns a Selection object that contains the item or items that are selected in the explorer window. Here is the sample how you can deal with the Selection object:

Sub GetSelectedItems() 
 Dim myOlExp As Outlook.Explorer 
 Dim myOlSel As Outlook.Selection
 Dim mySender As Outlook.AddressEntry 
 Dim oMail As Outlook.MailItem 
 Dim oAppt As Outlook.AppointmentItem 
 Dim oPA As Outlook.PropertyAccessor 
 Dim strSenderID As String 
 Const PR_SENT_REPRESENTING_ENTRYID As String = "http://schemas.microsoft.com/mapi/proptag/0x00410102"  
 Dim MsgTxt As String  
 Dim x As Long 
 
 MsgTxt = "Senders of selected items:"  
 Set myOlExp = Application.ActiveExplorer  
 Set myOlSel = myOlExp.Selection  
 For x = 1 To myOlSel.Count  
 If myOlSel.Item(x).Class = OlObjectClass.olMail Then  
 ' For mail item, use the SenderName property.  
 Set oMail = myOlSel.Item(x)  
 MsgTxt = MsgTxt & oMail.SenderName & ";"  
 ElseIf myOlSel.Item(x).Class = OlObjectClass.olAppointment Then  
 ' For appointment item, use the Organizer property.  
 Set oAppt = myOlSel.Item(x)  
 MsgTxt = MsgTxt & oAppt.Organizer & ";"  
 Else  
 ' For other items, use the property accessor to get the sender ID,  
 ' then get the address entry to display the sender name.  
 Set oPA = myOlSel.Item(x).PropertyAccessor  
 strSenderID = oPA.GetProperty(PR_SENT_REPRESENTING_ENTRYID)  
 Set mySender = Application.Session.GetAddressEntryFromID(strSenderID)  
 MsgTxt = MsgTxt & mySender.Name & ";"  
 End If  
 Next x  
 Debug.Print MsgTxt  
End Sub
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文