我在遍历 Outlook 2010 插件项目中的选定附件列表时遇到问题。
这是ribbon1.xml
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<ribbon>
<contextualTabs>
<tabSet idMso="TabSetAttachments">
<tab idMso="TabAttachments">
<group label="DWOS" id="DWOSAttachmentGroup">
<button id="btnSendToJobOrder"
size="large"
label="Send to Job/Order"
getImage="GetButtonImage"
onAction="OnMyButtonClick" />
</group>
</tab>
</tabSet>
</contextualTabs>
</ribbon>
</customUI>
这是我的 OnMyButtonClick 事件:
Public Sub OnMyButtonClick(ByVal control As Office.IRibbonControl)
Dim attachmentSelection As AttachmentSelection = TryCast(control.Context, AttachmentSelection) '<-- Error Here
For Each attachment As Outlook.Attachment In attachmentSelection
' Do Something
Next
End Sub
任何帮助是极大的赞赏。