如何将 olText UserProperty 添加到电子邮件
How to add an olText UserProperty to an email
我正在尝试使用 win32com 将 UserProperty 添加到电子邮件中。
UserPropertyType 应设置为 'olText'.
郑重声明,UserProperty 的名称 ('NewDomain') 已经是 Outlook UserProperties 集合的成员。
我试过以下方法:
import win32com.client as w32c
outlook=w32c.Dispatch('Outlook.Application').GetNameSpace('MAPI')
inbox=outlook.GetDefaultFolder(6)
emails=inbox.Items
email=emails.GetLast()
email.UserProperties.Add("NewDomain",UserPropertyType='olText',True)
我收到以下错误:
TypeError: Add() 得到了一个意外的关键字参数 'OlUserPropertyType'
代码在 VBA 中运行良好,语法如下:
email.UserProperties.Add("NewDomain", olText, True)
非常感谢您的帮助!
UserPropertyType 参数是枚举 (int),而不是字符串。 olText 是 1,所以你的代码必须是
email.UserProperties.Add("NewDomain", 1, True)
我正在尝试使用 win32com 将 UserProperty 添加到电子邮件中。 UserPropertyType 应设置为 'olText'.
郑重声明,UserProperty 的名称 ('NewDomain') 已经是 Outlook UserProperties 集合的成员。
我试过以下方法:
import win32com.client as w32c
outlook=w32c.Dispatch('Outlook.Application').GetNameSpace('MAPI')
inbox=outlook.GetDefaultFolder(6)
emails=inbox.Items
email=emails.GetLast()
email.UserProperties.Add("NewDomain",UserPropertyType='olText',True)
我收到以下错误: TypeError: Add() 得到了一个意外的关键字参数 'OlUserPropertyType'
代码在 VBA 中运行良好,语法如下: email.UserProperties.Add("NewDomain", olText, True)
非常感谢您的帮助!
UserPropertyType 参数是枚举 (int),而不是字符串。 olText 是 1,所以你的代码必须是
email.UserProperties.Add("NewDomain", 1, True)