-
Notifications
You must be signed in to change notification settings - Fork 8
Fix up definition of ExtendedProperty. #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
jtracey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far. Do you feel up for writing a test? It would be nice to at least have an example of the XML in question written down somewhere.
| pub property_id: Option<String>, | ||
|
|
||
| /// The value type of the desired property. | ||
| // TODO: This is a *required* field in the ms docs, but we seem to be receiving XML without it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, EWS is full of these kinds of bad docs. If you have an example response with it missing, I'd say we can rewrite this comment as a note instead of a TODO/question (even better if it gets added as a test).
| #[serde(rename = "ExtendedFieldURI")] | ||
| pub extended_field_URI: ExtendedFieldURI, | ||
|
|
||
| #[xml_struct(ns_prefix = "t")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the docs, this can actually be Value or Values. If we don't have any examples of the latter, we should at least leave a comment and make value optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, will keep an eye out for Values as I go, but if I don't see any I'll just add a comment.
I'd guess that both Value and Values would be marked optional? That said I bet there's some fancy macro to denote more complex relationships between fields... (which will then be completely ignored in some real world case which happily decides to send both :- )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd guess that both
ValueandValueswould be marked optional?
Yeah, that'd be the simplest way to go.
That said I bet there's some fancy macro to denote more complex relationships between fields... (which will then be completely ignored in some real world case which happily decides to send both :- )
The right way would be an enum that gets #serde(flatten)ed, but for technical reasons the XML deserialization library can get tripped up by that. Could be worth a shot, but if it doesn't work I'd just stick to marking them both optional.
Sure! |
Yep, though there's some leeway if it's easier/more concise to modify it for whatever reason. |
| // support using a nested structure to define an element's attributes, see | ||
| // https://github.com/thunderbird/xml-struct-rs/issues/9 | ||
| #[derive(Clone, Debug, Deserialize, XmlSerialize, Eq, PartialEq)] | ||
| #[serde(rename_all = "PascalCase")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just stumbled on this Problem while trying Thunderbird EWS.
[INFO ews_xpcom::client] Making operation request 1717c475-bb16-43f8-a1ee-bb457a076966: SyncFolderItems
[INFO ews_xpcom::client] Response received for request 1717c475-bb16-43f8-a1ee-bb457a076966 (status 200): SyncFolderItems
[ERROR ews_xpcom::safe_xpcom] an error occurred when performing operation SyncFolderItems: Ews(Deserialize(Error { path: Path { segments: [Map { key: "Body" }, Map { key: "SyncFolderItemsResponse" }, Map { key: "ResponseMessages" }, Map { key: "$value" }, Seq { index: 0 }, Map { key: "Changes" }, Map { key: "$value" }, Seq { index: 11 }, Enum { variant: "Create" }, Map { key: "$value" }, Enum { variant: "MeetingResponse" }, Map { key: "ExtendedProperty" }, Seq { index: 0 }] }, original: Custom("missing field `extended_field_URI`") }))
This makes the entire SyncFolderItems fail for any folder which contains items which implicitly return extended properties (like for example all items related to a calendar event).
EWS Documentation for this is at https://learn.microsoft.com/en-us/exchange/client-developer/web-service-reference/extendedproperty
Example:
<Create xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
<MeetingResponse
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
<ItemId
xmlns="http://schemas.microsoft.com/exchange/services/2006/types"
Id="AAAAADjoSSA+HUpPsqnGcQ2wGZMHAAYAAAClGHtvvNzqHtA8VlcAAAAAAA0AAAYAAAClGHtvvNzqHtA8VlcAAAAd9bcAAA=="
ChangeKey="OOhJID4dSk+yqcZxDbAZkyIAMGAAAA=="></ItemId>
<ItemClass
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
IPM.Schedule.Meeting.Resp.Pos</ItemClass>
<Size
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
0</Size>
<IsSubmitted
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</IsSubmitted>
<IsDraft
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</IsDraft>
<IsFromMe
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</IsFromMe>
<IsResend
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</IsResend>
<IsUnmodified
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</IsUnmodified>
<ReminderIsSet
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</ReminderIsSet>
<HasAttachments
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</HasAttachments>
<ExtendedProperty
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
<ExtendedFieldURI
xmlns="http://schemas.microsoft.com/exchange/services/2006/types"
DistinguishedPropertySetId="Appointment" PropertyId="0x8201"
PropertyType="Integer"></ExtendedFieldURI>
<Value
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
0</Value>
</ExtendedProperty>
<IsAssociated
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</IsAssociated>
<IsClutter
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</IsClutter>
<BlockStatus
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</BlockStatus>
<HasBlockedImages
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</HasBlockedImages>
<MentionedMe
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</MentionedMe>
<AtAllMention
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</AtAllMention>
<CanDelete
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</CanDelete>
<IsReadReceiptRequested
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</IsReadReceiptRequested>
<IsDeliveryReceiptRequested
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</IsDeliveryReceiptRequested>
<IsRead
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</IsRead>
<IsResponseRequested
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</IsResponseRequested>
<IsDelegated
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</IsDelegated>
<IsOutOfDate
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</IsOutOfDate>
<HasBeenProcessed
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</HasBeenProcessed>
<IsOrganizer
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
false</IsOrganizer>
</MeetingResponse>
</Create>
OK, so I'm still really stumbling around in the dark here, but these changes have got things working for me...
Not sure it's ready to land yet, but I'm at the point where I need some feedback.