REV_TAG = {} for K in sorted(Tags.__dict__, reverse=True): if K.startswith('PR_'): REV_TAG[Tags.__dict__[K]] = K PSETID_Appointment = DEFINE_OLEGUID(0x00062002, 0, 0) PSETID_Task = DEFINE_OLEGUID(0x00062003, 0, 0) PSETID_Address = DEFINE_OLEGUID(0x00062004, 0, 0) PSETID_Common = DEFINE_OLEGUID(0x00062008, 0, 0) PSETID_Log = DEFINE_OLEGUID(0x0006200A, 0, 0) PSETID_Note = DEFINE_OLEGUID(0x0006200E, 0, 0) PSETID_Sharing = DEFINE_OLEGUID(0x00062040, 0, 0) PSETID_PostRss = DEFINE_OLEGUID(0x00062041, 0, 0) PS_INTERNET_HEADERS = DEFINE_OLEGUID(0x00020386, 0, 0) PSETID_Archive = DEFINE_GUID(0x72e98ebc, 0x57d2, 0x4ab5, 0xb0, 0xaa, 0xd5, 0x0a, 0x7b, 0x53, 0x1c, 0xb9) PSETID_Meeting = DEFINE_GUID(0x6ED8DA90, 0x450B, 0x101B, 0x98, 0xDA, 0x00, 0xAA, 0x00, 0x3F, 0x13, 0x05) PSETID_Kopano_CalDav = DEFINE_GUID(0x77536087, 0xcb81, 0x4dc9, 0x99, 0x58, 0xea, 0x4c, 0x51, 0xbe, 0x34, 0x86) PSETID_AirSync = DEFINE_GUID(0x71035549, 0x0739, 0x4DCB, 0x91, 0x63, 0x00, 0xF0, 0x58, 0x0D, 0xBB, 0xDF) PSETID_UnifiedMessaging = DEFINE_GUID(0x4442858E, 0xA9E3, 0x4E80, 0xB9, 0x00, 0x31, 0x7A, 0x21, 0x0C, 0xC1, 0x5B) PSETID_CONTACT_FOLDER_RECIPIENT = DEFINE_GUID(0x0AAA42FE, 0xC718, 0x101A, 0xE8, 0x85, 0x0B, 0x65, 0x1C, 0x24, 0x00, 0x00) PSETID_ZMT = DEFINE_GUID(0x8acdbf85, 0x4738, 0x4dc4, 0x94, 0xa9, 0xd4, 0x89, 0xa8, 0x3e, 0x5c, 0x41) PSETID_CalendarAssistant = DEFINE_GUID(0x11000E07, 0xB51B, 0x40D6, 0xAF, 0x21, 0xCA, 0xA8, 0x5E, 0xDA, 0xB1, 0xD0)
# SPDX-License-Identifier: AGPL-3.0-only from MAPI import (TBL_BATCH, MAPI_UNICODE, MAPI_DISTLIST, FL_FULLSTRING, FL_IGNORECASE, DT_REMOTE_MAILUSER, MAPI_MAILUSER, DT_GLOBAL, RELOP_EQ, RELOP_NE, BOOKMARK_BEGINNING) from MAPI.Defs import DEFINE_GUID from MAPI.Tags import (PR_ENTRYID, PR_EMS_AB_CONTAINERID, PR_DISPLAY_TYPE, PR_DISPLAY_NAME_W, PR_DISPLAY_NAME_A, PR_EMAIL_ADDRESS_A, PR_EMAIL_ADDRESS_W, PR_OBJECT_TYPE) from MAPI.Struct import (SPropertyRestriction, SOrRestriction, SExistRestriction, SAndRestriction, SPropValue, SContentRestriction) MUIDECSAB = DEFINE_GUID(0x50a921ac, 0xd340, 0x48ee, 0xb3, 0x19, 0xfb, 0xa7, 0x53, 0x30, 0x44, 0x25) def GetGab(session): ab = session.OpenAddressBook(0, None, 0) root = ab.OpenEntry(None, None, 0) table = root.GetHierarchyTable(0) table.SetColumns([PR_ENTRYID], TBL_BATCH) restriction = SOrRestriction([ SPropertyRestriction(RELOP_EQ, PR_DISPLAY_TYPE, SPropValue(PR_DISPLAY_TYPE, DT_GLOBAL)), SAndRestriction([ SExistRestriction(PR_EMS_AB_CONTAINERID), SPropertyRestriction(RELOP_EQ, PR_EMS_AB_CONTAINERID, SPropValue(PR_EMS_AB_CONTAINERID, 0)) ]) ]) table.FindRow(restriction, BOOKMARK_BEGINNING, 0)