I am trying to add potential arguments to a variable dynamically, and send it to the filter function of exchangelib. I can't get it work. This is what's currently working:
sender='abd@google.com'
accountSource.bulk_move(ids=sourceAccountFolder.filter(sender), to_folder=destinationAccountFolder)
This is what I would like to do:
params = { sender: 'asd@google.com', subject:'asdf'}
accountSource.bulk_move(ids=sourceAccountFolder.filter(params), to_folder=destinationAccountFolder)
This doesn't work
The idea is to dynamically add params if needed. For example, I could add subject = 'subjectSample' to params variable.
Thank you
Update:
This did work:
params = { 'sender': 'anemail@abc.com', 'subject__icontains': 'xxx'}
accountSource.bulk_move(ids=sourceAccountFolder.filter(**params).values('item_id', 'changekey'), to_folder=destinationAccountFolder)