簡體   English   中英

在 Outlook 中訪問用戶定義的字段

[英]Accessing User Defined Fields in Outlook

因此,我有一個如下所示的自定義電子郵件表單/消息,我想訪問“文檔標題:”字段值以將其插入電子郵件正文。

我目前有這個代碼;

Function Item_Send()
    Item.Body = Item.Body + UserProperties.Find("TextBox1").Text
End Function

我已經嘗試了多種變體,例如Item.UserProperties.Find(...).ValueFind(...).Value本身、 UserProperties.Find("TextBox1", false).Text等.

研究;
代碼項目
MSDN 查找方法文檔
Microsoft 支持 - 如何創建電子郵件表單
Microsoft 支持 - 關於自定義 Outlook 表單的常見問題解答
Microsfot 支持 - 使用用戶定義的字段

我似乎無法找到解決方案。
發布的代碼返回Object requred: 'UserProperties.Find(...)'
如果我將false添加到我得到的參數中; Object doesn't support this property of method: 'UserProperties.Find'
查找本身給我Type mismatch: 'Find'

這就是我能得到的所有錯誤信息。 任何幫助將不勝感激。 (我使用腳本編輯器按鈕來編寫上面的代碼,而不是 Visual Basic 按鈕)。

在此處輸入圖像描述

將有問題的行更改為

set prop = Item.UserProperties.Find("TextBox1")
if Not (prop Is Nothing) Then
  Item.Body = Item.Body + prop.Value
End If

還要確保屬性名稱確實是“TextBox1”,這聽起來像一個控件名稱。 使用OutlookSpy查看項目:單擊項目按鈕,選擇 UserProperties 屬性,單擊瀏覽,轉到 IEnumVariant 選項卡,雙擊該屬性。

您還可以單擊 IMessage 按鈕查看原始 MAPI 屬性。

您永遠不會檢查UserProperties.Find返回 null。 將有問題的行更改為

set prop = Item.UserProperties.Find("TextBox1")
if Not (prop Is Nothing) Then
  Item.Body = Item.Body + prop.Value
End If

還要確保屬性名稱確實是“TextBox1”,這聽起來像是一個控件名稱。 使用OutlookSpy (我是其作者)查看項目:單擊項目按鈕,選擇 UserProperties 屬性,單擊瀏覽,轉到 IEnumVariant 選項卡,雙擊該屬性。

您還可以單擊 IMessage 按鈕查看原始 MAPI 屬性。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM