在 Outlook 中访问用户定义的字段 [英] Accessing User Defined Fields in Outlook

查看:50
本文介绍了在 Outlook 中访问用户定义的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我有一个如下所示的自定义电子邮件表单/消息,我想访问文档标题:"字段值以将其插入到电子邮件正文中.

我目前有这个代码;

函数Item_Send()Item.Body = Item.Body + UserProperties.Find("TextBox1").Text结束函数

我已经尝试了多种变体,例如 Item.UserProperties.Find(...).Value, Find(...).Value本身,UserProperties.Find("TextBox1", false).Text

研究;
的项目:单击 Item 按钮,选择 UserProperties 属性,单击浏览,转到 IEnumVariant 选项卡,双击该属性.

您还可以单击 IMessage 按钮查看原始 MAPI 属性.

So, I have a custom email form/message like below and I want to access the "Doc Title:" field value to insert it into the body of the email.

I currently have this code;

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

And I've tried multiple variations of this, such as Item.UserProperties.Find(...).Value, Find(...).Value by itself, UserProperties.Find("TextBox1", false).Text, etc.

Research;
CodeProject
MSDN Find Method Documentation
Microsoft Support - How to create an email message form
Microsoft Support - FAQ about custom outlook forms
Microsfot Support - Working with User Defined Fields

I just can't seem to find a solution.
The posted code returns Object requred: 'UserProperties.Find(...)'
If I add in false to the parameters I get; Object doesn't support this property of method: 'UserProperties.Find'
Find by itself gives me Type mismatch: 'Find'

And that's all the error messages I can get to come up. Any help would be greatly appreciated. (I'm using the Script Editor button to write the above code, not the Visual Basic button).

解决方案

Change the problematic line to

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

Also make sure the property name is really "TextBox1", that sounds like a control name. Have a look at the item with OutlookSpy: click Item button, select the UserProperties property, click browse, go to the IEnumVariant tab, double click on the property.

You can also click the IMessage button to see the raw MAPI properties.

这篇关于在 Outlook 中访问用户定义的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆