【问题标题】:Reading customized tags/flags in outlook using ExchangeLib in Python 3.7在 Python 3.7 中使用 ExchangeLib 在 Outlook 中读取自定义标签/标志
【发布时间】:2021-04-26 06:55:03
【问题描述】:

我正在阅读 Outlook 中包含自定义标签/标志的邮件。其中一个是标签“已批准”。我正在尝试使用 python 中的 ExchangeLib 库访问标记为“已批准”的特定发件人的邮件。

我尝试了 ExchangeLib 库中提供的多种方法,但没有成功。我只是想在控制台中打印出这个标签“已批准”。我尝试了以下方法:

ID_ELEMENT_CLS account add_field attach attachments body categories conversation_id culture datetime_created datetime_received datetime_sent deregister detach display_cc display_to effective_rights folder has_attachments headers importance in_reply_to is_associated is_draft is_from_me is_resend is_submitted is_unmodified item_class last_modified_name last_modified_time mime_content parent_folder_id register reminder_due_by reminder_is_set reminder_minutes_before_start remove_field response_objects sensitivity size subject supported_fields text_body unique_body validate_field web_client_edit_form_query_string web_client_read_form_query_string

Python - 3.7 Exchangelib - 3.3.2

Image "Customized_Tags" contains "Approved" Tag

参考下面的代码截图:

from exchangelib import Credentials, Account

credentials = Credentials('john@example.com', 'topsecret')
account = Account('john@example.com', credentials=credentials, autodiscover=True)
for item in account.inbox.all().order_by('-datetime_received')[:100]:
    #below is my requirement
    if item.tag == "Approved":
        print(item.tag, item.sender)
    else:
         pass

【问题讨论】:

    标签: python-3.x exchangelib


    【解决方案1】:

    标志是 Exchange 中所谓的扩展属性。 https://ecederstrand.github.io/exchangelib/#extended-properties

    有关于在 exchangelib 中使用扩展属性的信息

    您必须找到代表包含标志数据的扩展属性的魔术令牌,然后在 exhcangelib 中定义一个自定义字段并将其注册为一个名为 tag 的新字段。

    【讨论】:

    • 感谢@Erik 提供的详细信息,我们已经浏览了链接 (ecederstrand.github.io/exchangelib/#extended-properties) 并了解了设置扩展属性的过程。尝试设置如下:class Flag(ExtendedProperty): property_tag = 0x1090 property_type = 'Integer' 但找不到用户定义的“标签”的确切属性标签/uuid。
    • 嗨,Erik,我也尝试了下面的代码,但它仍然没有给出标签值: distinct_property_set_id = 'PublicStrings' property_name = 'test' property_type = 'String' 你能帮我找到确切的属性标签吗.
    猜你喜欢
    • 2012-07-13
    • 1970-01-01
    • 1970-01-01
    • 2019-07-29
    • 1970-01-01
    • 2023-03-21
    • 1970-01-01
    • 2020-07-29
    • 1970-01-01
    相关资源
    最近更新 更多