更新 : 2007 年 11 月
対象 |
---|
このトピックの情報は、指定された Visual Studio Tools for Office プロジェクトおよび Microsoft Office のバージョンにのみ適用されます。 プロジェクトの種類
Microsoft Office のバージョン
詳細については、「アプリケーションおよびプロジェクトの種類別の使用可能な機能」を参照してください。 |
この例では、メール アイテムのコピーを作成し、ユーザーに表示します。
使用例
Private Sub ThisAddIn_Startup(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Startup
Dim mail As Outlook.MailItem = _
TryCast(Me.Application.GetNamespace("MAPI"). _
GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox). _
Items.GetFirst(), Outlook.MailItem)
If mail IsNot Nothing Then
' Create a copy of the item.
Dim copyMail As Outlook.MailItem = _
TryCast(mail.Copy(), Outlook.MailItem)
' Show the copy to the user.
copyMail.Display(True)
End If
End Sub
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
Outlook.MailItem mail = this.Application.GetNamespace("MAPI").
GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox).
Items.GetFirst() as Outlook.MailItem;
if (mail != null)
{
// Create a copy of the item.
Outlook.MailItem copyMail = mail.Copy() as Outlook.MailItem;
// Show the copy to the user.
copyMail.Display(true);
}
}