Support GetUserRetentionPolicyTags service
Hi Team ,
Could you please help us to read below two attributes/fields of an email Retention policy Expires
I have searched in headers , but no luck
Thanks in advance
I can’t find any documentation that these fields should be available on an EWS message item. Do you have a link describing these fields?
https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/whats-new-in-ews-and-other-web-services-in-exchange
https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/getuserretentionpolicytags-operation?redirectedfrom=MSDN
Ah, ok. The GetUserRetentionPolicyTags service is not yet supported in exchangelib.
I still don't know what Expires refers to here.
In EWS , they have named it as retention date Here is the documentation from EWS
https://docs.microsoft.com/en-us/dotnet/api/microsoft.exchange.webservices.data.item.retentiondate
Hi, I have also similar task needs to be done using the exchangelib in python to get the rentention date.please provide a update on this.
I don't have any plans to work on this myself in the near future. Contributions are welcome, as always.
I know this one is old, but thought I'd update what I did during recent testing. I'm very new to python so, I'm sure there's better ways to do this, but I just followed the same logic for flags referenced here: https://github.com/ecederstrand/exchangelib/issues/85#issuecomment-283448809
I had to convert the binary (bytes) to a Microsoft system GUID, so used a function referenced here.
class Label(ExtendedProperty):
property_tag = 0x3019
property_type = 'Binary'
def to_guid():
b = self.value
return '-'.join(map(bytes.decode, map(
binascii.hexlify, (b[0:4][::-1], b[4:6][::-1], b[6:8][::-1], b[8:10], b[10:])
)))
Message.register('label', Label)
for m in account.inbox.all():
if m.label:
print("Subject: " + m.subject)
print("Label: " + m.label.to_guid())
End result:
Subject: Test email with M365 retention label
Label: 37d7071b-7818-4e98-ae3e-56c0dc330119
Which, with the GUID, you can pull back the name using EXO PowerShell:
Get-ComplianceTag 37d7071b-7818-4e98-ae3e-56c0dc330119 | select Name
Name
----
7YearRecord-LastModified
I think the label names are stored/accessible via EWS since EWSEditor can pull them, but that's as far as I got.
I also didn't look at the Expiration date, but based on the EWSEditor references, I think it might be 0x301c as SystemTime property type