我在浏览Outlook 2010 Addin项目中的所选附件列表时遇到问题。
这是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
非常感谢任何帮助。