Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.9k views
in Technique[技术] by (71.8m points)

Reading customized tags/flags in outlook using ExchangeLib in Python 3.7

I am reading the mails in outlook which contains customized tags/flags. Among which one is tag "Approved". I am trying to access the mail from particular sender whose tag is "Approved" using ExchangeLib Library in python.

I tried with multiple methods available in ExchangeLib library but no luck. I just wanted to print out this tag "Approved" in console. I tried with below methods:

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

refer below Snap of code:

from exchangelib import Credentials, Account

credentials = Credentials('[email protected]', 'topsecret')

account = Account('[email protected]', 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```

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Flags are so-called extended properties in Exchange. There's information on working with extended properties in exchangelib at https://ecederstrand.github.io/exchangelib/#extended-properties

You have to find the magic token that represents the extended property containing the flag data, and then define a custom field in exhcangelib and register it as a new field called tag.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...