Skip to content

ErrorAccessDenied thrown if folder contains private items #342

@PyTomE

Description

@PyTomE

Hi,
maybe I tried it the wrong way around, maybe I just stuck somewhere. However, I try to connect to an exchange server in order to extract several calendars.
In general this works, thanks to your great tool, but now I try the following:
I have a generic user, say "generic" which can access others calendars whenever they grant this user access within Outlook.
This works until a user sets an appointment to "private", which shouldn't be a huge problem but...
...

account = Account(primary_smtp_address=user_account, config=config,
                      autodiscover=False, access_type=DELEGATE)
items = account.calendar.view(start=startdate, end=enddate) # Filter by a date range
for item in items.all().order_by('start'): # no matter if order_by is used or not
    ... do something...

Traceback (most recent call last):
  File "getCalendar.py", line 109, in <module>
    for item in items.all().order_by('start'):
  File "e:\progs\Continuum\Anaconda2\lib\site-packages\exchangelib\queryset.py", line 197, in __iter__
    for val in result_formatter(self._query()):
  File "e:\progs\Continuum\Anaconda2\lib\site-packages\exchangelib\queryset.py", line 163, in _query
    items = sorted(items, key=f.field_path.get_value, reverse=f.reverse)
  File "e:\progs\Continuum\Anaconda2\lib\site-packages\exchangelib\account.py", line 534, in fetch
    for i in GetItem(account=self).call(items=ids, additional_fields=additional_fields, shape=IdOnly):
  File "e:\progs\Continuum\Anaconda2\lib\site-packages\exchangelib\services.py", line 456, in _pool_requests
    for elem in elems:
  File "e:\progs\Continuum\Anaconda2\lib\site-packages\exchangelib\services.py", line 283, in _get_elements_in_response
    container_or_exc = self._get_element_container(message=msg, name=self.element_container_name)
  File "e:\progs\Continuum\Anaconda2\lib\site-packages\exchangelib\services.py", line 256, in _get_element_container
    self._raise_errors(code=response_code, text=msg_text, msg_xml=msg_xml)
  File "e:\progs\Continuum\Anaconda2\lib\site-packages\exchangelib\services.py", line 273, in _raise_errors
    raise vars(errors)[code](text)
exchangelib.errors.ErrorAccessDenied: Access is denied. Check credentials and try again.

I tried to dive into the code but it looks as if exchangelib tries to inspect the elements in the queryset too much and fails while creating the iterator.
Thus I found no way to circumvent that problem but rewriting the services-module (didn't do that yet).
Is there anything I missed yet? Or a better way to handle this?

Thanks in advance
Thomas

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions