Skip to content
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

$search in on_get_messages does not work #6

Open
marlemion opened this issue Aug 17, 2021 · 3 comments
Open

$search in on_get_messages does not work #6

marlemion opened this issue Aug 17, 2021 · 3 comments

Comments

@marlemion
Copy link

marlemion commented Aug 17, 2021

If I retreive messages with a query, i.e.:

api/gc/v1/me/mailFolders/AAAAAG55cVcpA0rYlYKRcCRup8YBAAAAAwAAAMwL-82Ny0ZQud98sYamzIAAAAAA/messages?$top=1000&$search=subject%3DYour

The list of messages is generated. However, the nextlink looks like that:

api/gc/v1/me/mailFolders/AAAAAG55cVcpA0rYlYKRcCRup8YBAAAAAwAAAMwL-82Ny0ZQud98sYamzIAAAAAA/messages?$top=1000&$search=subject%3DYour&$skip=1000

Here, the 'skip' part is ignored. Hence, with this link, again all messages are retrieved. Normally, one has to write a function checking for the nextlink. If the the nextlink returns values, check again for the next nextlink and so on, until the returned value is empty. As in this case, the value never will be empty, the function will never end.

This works with plain api/gc/v1/me/mailFolders/AAAAAG55cVcpA0rYlYKRcCRup8YBAAAAAwAAAMwL-82Ny0ZQud98sYamzIAAAAAA/messages?$top=1000

The culprit seems to lie in backend/kopano/resource.py, in particular in folder_gen, where for queries a yielder() function is provided to replace the actual folder.items generator. count is set 0. But event with a correct count of the generator (i.e. via count = len([item for item in folder.items(quer=query)) the problem remains. I have tried to implement a lambda expression here but was not successful.

This is a pity, as it prevents filtering messages in mailfolders.

@marlemion
Copy link
Author

Proposed change: #7

@marlemion
Copy link
Author

OK, I have tested this further and it fails with server.users(), as this generator does not know 'restrictions'.

Hence I come up with this simpler and maybe more complete (?) solution:

#9

@fbartels
Copy link
Contributor

fbartels commented Sep 1, 2021

Hi @marlemion,

sorry for the long wait. We are currently busy with some other projects and have therefore did not have the time to further look into your changes. The plan is to pick this up again starting in october.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants