WinRb / Viewpoint

A Ruby client access library for Microsoft Exchange Web Services (EWS)
Apache License 2.0
248 stars 171 forks source link

Possible to query for ALL mail instead of having to loop through each sub-folder? #229

Open jwg2s opened 8 years ago

jwg2s commented 8 years ago

We're trying to sync all mail in a given user's account. However, we've found that the only way we can get all mail (including numerous sub-folders) is to loop through each sub-folder and request a given date range.

This is obviously extremely inefficient, but the only way we've been able to figure out how to pull absolutely all mail.

Any other ideas?

jwg2s commented 8 years ago

@zenchild perhaps it would be possible to quickly get a list of folders + their item counts? That way we could decide which folders we need to even bother with? e.g. user has 500 sub folders and 250 of the are empty, we'd save 250 requests not looking in them.

Also, is there a more targeted way to get sub-folders that contain mail?

sub_folders = Viewpoint::EWSClient.new(*client_params).folders(:root => :inbox).map(&:name) - %w(Drafts)
jwg2s commented 8 years ago

We ended up switching to use Office365's REST API to replace our Viewpoint integration. REST vs SOAP is a no-brainer. Obviously not all Exchange accounts are hosted with Office365, but the majority of our Microsoft-using clients use Office365 so sadly our work with Viewpoint will likely decrease going forward.