{"action":"created","issue":{"url":"https://api.github.com/repos/ecederstrand/exchangelib/issues/498","repository_url":"https://api.github.com/repos/ecederstrand/exchangelib","labels_url":"https://api.github.com/repos/ecederstrand/exchangelib/issues/498/labels{/name}","comments_url":"https://api.github.com/repos/ecederstrand/exchangelib/issues/498/comments","events_url":"https://api.github.com/repos/ecederstrand/exchangelib/issues/498/events","html_url":"https://github.com/ecederstrand/exchangelib/issues/498","id":367283500,"node_id":"MDU6SXNzdWUzNjcyODM1MDA=","number":498,"title":"Adding Extended Property to some events fails complaining about other fields not being editable","user":{"login":"mcv21","id":4921855,"node_id":"MDQ6VXNlcjQ5MjE4NTU=","avatar_url":"https://avatars3.githubusercontent.com/u/4921855?v=4","gravatar_id":"","url":"https://api.github.com/users/mcv21","html_url":"https://github.com/mcv21","followers_url":"https://api.github.com/users/mcv21/followers","following_url":"https://api.github.com/users/mcv21/following{/other_user}","gists_url":"https://api.github.com/users/mcv21/gists{/gist_id}","starred_url":"https://api.github.com/users/mcv21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcv21/subscriptions","organizations_url":"https://api.github.com/users/mcv21/orgs","repos_url":"https://api.github.com/users/mcv21/repos","events_url":"https://api.github.com/users/mcv21/events{/privacy}","received_events_url":"https://api.github.com/users/mcv21/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-10-05T16:31:11Z","updated_at":"2018-10-08T10:10:46Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nI'm trying to add an ExtendedProperty to some events, defined thus:\r\n```python\r\nclass ex_gcal_link(exchangelib.ExtendedProperty):\r\n    distinguished_property_set_id = 'PublicStrings'\r\n    property_name = \"google calendar event id\"\r\n    property_type = 'String'\r\n\r\nexchangelib.CalendarItem.register('gcal_link',ex_gcal_link)\r\n```\r\n\r\nThis generally works fine, but if I try and add it to some existing items (perhaps ones I wasn't the original owner for), I get some confusing errors. I'm looking up the event by Item_ID, FWIW.\r\n\r\nThe code does:\r\n```python\r\n                event.gcal_link = ge['id']\r\n                event.save()\r\n```\r\n\r\nThe first exception is:\r\n```\r\n File \"./gooswapper.py\", line 204, in match_ex_to_gcal\r\n    event.save()\r\n  File \"/upstreams/exchangelib/exchangelib/items.py\", line 252, in save\r\n    send_meeting_invitations=send_meeting_invitations\r\n  File \"/upstreams/exchangelib/exchangelib/items.py\", line 334, in _update\r\n    send_meeting_invitations_or_cancellations=send_meeting_invitations)\r\n  File \"/upstreams/exchangelib/exchangelib/account.py\", line 462, in bulk_update\r\n    suppress_read_receipts=suppress_read_receipts,\r\n  File \"/upstreams/exchangelib/exchangelib/account.py\", line 457, in <genexpr>\r\n    i if isinstance(i, Exception) else Item.id_from_xml(i)\r\n  File \"/upstreams/exchangelib/exchangelib/account.py\", line 319, in _consume_item_service\r\n    for i in service_cls(account=self, chunk_size=chunk_size).call(**kwargs):\r\n  File \"/upstreams/exchangelib/exchangelib/services.py\", line 612, in _pool_requests\r\n    for elem in elems:\r\n  File \"/upstreams/exchangelib/exchangelib/services.py\", line 312, in _get_elements_in_response\r\n    container_or_exc = self._get_element_container(message=msg, name=self.element_container_name)\r\n  File \"/upstreams/exchangelib/exchangelib/services.py\", line 287, in _get_element_container\r\n    raise self._get_exception(code=response_code, text=msg_text, msg_xml=msg_xml)\r\nexchangelib.errors.ErrorInvalidPropertySet: Set action is invalid for property. (field: <t:FieldURI xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\" xmlns:m=\"http://schemas.microsoft.com/exchange/services/2006/messages\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" FieldURI=\"calendar:IsResponseRequested\"/>)\r\n```\r\n\r\nSeeing some similar issues here before, I tried setting that to `None` (i.e. `event.is_response_requested=None` before the save). That stopped that exception, but then I get a different one (same backtrace):\r\n```\r\n    raise self._get_exception(code=response_code, text=msg_text, msg_xml=msg_xml)\r\nexchangelib.errors.ErrorInvalidPropertySet: Set action is invalid for property. (field: <t:FieldURI xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\" xmlns:m=\"http://schemas.microsoft.com/exchange/services/2006/messages\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" FieldURI=\"calendar:RequiredAttendees\"/>)\r\n```\r\n\r\nSo I tried setting that to None, but I can't do that:\r\n```\r\n    raise self._get_exception(code=response_code, text=msg_text, msg_xml=msg_xml)\r\nexchangelib.errors.ErrorInvalidPropertyDelete: The delete action is not supported for this property. (field: <t:FieldURI xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\" xmlns:m=\"http://schemas.microsoft.com/exchange/services/2006/messages\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" FieldURI=\"calendar:RequiredAttendees\"/>)\r\n```\r\n\r\nIf I wanted to change, say, the Subject, then this would be OK, because I could pass update_fields=\"Subject\" to save, but I can't usefully do that with my extended property (or at least, not and have the field updated - if I try save(update_fields=\"gcal_link\"), then the extended property isn't changed, although I no longer get the above errors).\r\n\r\nSo I think the problem here is two-fold:\r\n1. `save()` is trying to update fields it shouldn't (and I don't think I can stop it doing so)\r\n2. there isn't a way to tell `save()` to only update extended properties\r\n\r\nAgain, sorry if I've missed something obvious, and thank you for a very useful library!"},"comment":{"url":"https://api.github.com/repos/ecederstrand/exchangelib/issues/comments/427782132","html_url":"https://github.com/ecederstrand/exchangelib/issues/498#issuecomment-427782132","issue_url":"https://api.github.com/repos/ecederstrand/exchangelib/issues/498","id":427782132,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNzc4MjEzMg==","user":{"login":"ecederstrand","id":559151,"node_id":"MDQ6VXNlcjU1OTE1MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/559151?v=4","gravatar_id":"","url":"https://api.github.com/users/ecederstrand","html_url":"https://github.com/ecederstrand","followers_url":"https://api.github.com/users/ecederstrand/followers","following_url":"https://api.github.com/users/ecederstrand/following{/other_user}","gists_url":"https://api.github.com/users/ecederstrand/gists{/gist_id}","starred_url":"https://api.github.com/users/ecederstrand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ecederstrand/subscriptions","organizations_url":"https://api.github.com/users/ecederstrand/orgs","repos_url":"https://api.github.com/users/ecederstrand/repos","events_url":"https://api.github.com/users/ecederstrand/events{/privacy}","received_events_url":"https://api.github.com/users/ecederstrand/received_events","type":"User","site_admin":false},"created_at":"2018-10-08T10:10:46Z","updated_at":"2018-10-08T10:10:46Z","author_association":"OWNER","body":"Thanks for the PR! I just committed a slightly different fix to the problem which throws an error for all code paths, not just via `some_item.save()`. With the new code, you would have gotten the following error message: `Field name(s) 'g', 'c', 'a', 'l', '_', 'l', 'i', 'n', 'k' are not valid for a 'CalendarItem' item` which I assume would give you a hint about what to fix :-)"}}
{"actor":{"display_login":"ecederstrand"}}