After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 685795 - Be able to open mailbox of other user
Be able to open mailbox of other user
Status: RESOLVED FIXED
Product: evolution-ews
Classification: Other
Component: Mail
3.6.x
Other Linux
: Normal enhancement
: ---
Assigned To: Evolution EWS maintainer(s)
Evolution EWS maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-10-09 09:41 UTC by Erik van Pienbroek
Modified: 2012-11-30 22:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ews patch (46.94 KB, patch)
2012-11-14 15:29 UTC, Milan Crha
committed Details | Review
ews patch ][ (28.81 KB, patch)
2012-11-16 16:16 UTC, Milan Crha
committed Details | Review
ews patch ]I[ (4.51 KB, patch)
2012-11-19 16:17 UTC, Milan Crha
committed Details | Review

Description Erik van Pienbroek 2012-10-09 09:41:04 UTC
Hi,

In evo 3.6 a feature was added to open folders from other users. I've tried to use this feature in our environment.

In our environment we are using personal mail boxes and group mail boxes. The group mail boxes can be accessed by multiple users.

In evo I've created an account for my personal mailbox. From within this account I tried to subscribe to the Inbox of the group mailbox. This works fine. However, the group mailbox itself contains various subfolders beneath the Inbox. These subfolders currently aren't being shown by evo.

Could this be implemented? It is currently the only blocking feature which prevents me from using evo for exchange mailboxes

Thanks
Comment 1 Milan Crha 2012-11-08 18:09:17 UTC
Thanks for a bug report. There is not possible to read content of other user's folder, thus ews cannot subscribe to these subfolders on its own. You may tell its IDs to be able to subscribe other than default folders (Inbox, Calendar, ...). It's the same as Outlook does it.

I'm wondering, is this group mailbox accessed through Public Folders, rather than through personal malboxes?
Comment 2 Erik van Pienbroek 2012-11-08 18:26:36 UTC
Hi Milan,

Thanks for your reply

I don't know exactly what the internal name for this feature is, but here's a small howto with screenshots of MS Outlook 2007 which shows how additional mailboxes can be added: http://www.groovypost.com/howto/microsoft/outlook/add-additional-mailbox-to-outlook-2007/

As far as I know this mailbox is not a public folder, but just a regular mailbox which multiple (authorized) people can access
Comment 3 Milan Crha 2012-11-09 10:01:00 UTC
Aah, I see. You can open a mailbox of a different user, not just a folder. The Subscribe is used for one folder only (one in a time), while you want something different. Let's make this an enhancement. I think this will be easiest if user will be able to define mailbox name to open, but connect to it with his/her own credentials.
Comment 4 Erik van Pienbroek 2012-11-09 12:22:52 UTC
That's exactly what I was looking for.
My apologies for the confusion
Comment 5 Milan Crha 2012-11-13 17:46:37 UTC
To not lost the link, here is written how to setup impersonation on the server:
http://msdn.microsoft.com/en-us/library/exchange/bb204095%28v=exchg.80%29.aspx
Comment 6 Milan Crha 2012-11-14 11:08:32 UTC
The above is setup for Exchange 2007 servers, while this one is for Exchange 2010 servers: http://msdn.microsoft.com/en-us/library/bb204095.aspx

With that I can read the content of other user account when using ExchangeImpersonation, hence it seems doable.
Comment 7 Milan Crha 2012-11-14 15:29:12 UTC
Created attachment 228972 [details] [review]
ews patch

for evolution-ews;

It's not that complicated, after all. This patch does two things:
a) it allows opening mailbox of other user when creating new account, by providing that user's email or login. User can search for it too. This way you do not get only the mailbox, but also Contacts, Calendars, ... if allowed by a permissions.
b) it fixes an issue when user changed username in account preferences. The state before the patch just returned EWS_CONNECTION_ERROR_INVALIDSYNCSTATEDATA and was not able to recover from this error, it reads "Synchronization state data is corrupt or otherwise invalid". With the patch each respective part vanishes all its internal cache and starts from scratch.
Comment 8 Milan Crha 2012-11-14 15:30:38 UTC
Created commit 6775f24 in ews master (3.7.2+)
Comment 9 Erik van Pienbroek 2012-11-14 19:50:35 UTC
Thanks for implementing this!

I just tried it out but as soon as I enable the 'Open mailbox of other user' feature then the server returns 'Internal server error' messages. With EWS_DEBUG=2 set I can see that the SOAP requests contains ExchangeImpersonation tags along with the name of the other mailbox I added. As I consider the EWS_DEBUG=2 output to contain sensitive information I'd rather not publish the logs directly on bugzilla. I can supply you the logs in private on IRC. I'm already hanging around in #evolution on GIMPnet (my nick is 'epienbro). Could we continue the investigation there?
Comment 10 Milan Crha 2012-11-15 15:49:56 UTC
Thanks for the testing. I was testing this with an Exchange 2010 server, hence I guess the issue is that Exchange 2007 doesn't understand it? Nonetheless, feel free to send me the log directly (to my bugzilla email), only mention this bug in a subject, thus I'll not miss it between other (junk) messages. Though the interesting part is the last error message, especially the body of the server reply, where should be written what the server dislikes on the request. By the way, the expected value for the other user is either his login or email, but with no extra special letters, like quotes and such, which may break the XML as such. The best if you use the Search button to get an expected value (though I guess you did so).
Comment 11 Milan Crha 2012-11-15 19:06:36 UTC
I'm reopening this. We got a live debugging and it turned out that Erik's server doesn't have setup Impersonation, but the server user has set permissions to others to change content of his/her mbox, probably (let's check on this detail later). The thing is that FindFolder request with 
   <ParentFolderIds>
      <types:DistinguishedFolderId Id="inbox">
         <types:Mailbox>
            <types:EmailAddress>user@exchange.com</types:EmailAddress>
         </types:Mailbox>
      </types:DistinguishedFolderId>
   </ParentFolderIds>
returns folders of the other user.
Comment 12 Milan Crha 2012-11-16 16:16:15 UTC
Created attachment 229157 [details] [review]
ews patch ][

for evolution-ews;

I decided to do a different approach, to not have too complex code. All this patch does is that it adds "Include subfolders" checkbox into "Subscribe to folder of other users", which currently works for Inbox (mail folders) only, but that's rather because other folder types are created in a flat hierarchy, not as a children of those default folders. Now, the "Include subfolders" makes the EWS camel provider check folder structure on a foreign folder, always after the provider connects to the server (it might be enough to go offline and online to get folder structure changes), and provides hierarchy of subfolders for the selected foreign user. This is shown in "Foreign Folders/Mailbox - User Name/..." subfolders of current EWS account. It also allows adding more users, then the User2 will be in path "Foreign Folders/Mailbox - User2 Name/...". This can be used instead of Impersonation.

I didn't test it, but I guess both methods can be combined together, thus user can impersonate to one user, and then subscribe to folders of another user, with permissions of the impersonated user.
Comment 13 Milan Crha 2012-11-16 16:17:57 UTC
Created commit fc96af8 in ews master (3.7.2+)
Comment 14 Erik van Pienbroek 2012-11-16 18:39:53 UTC
Hi Milan,

Thanks for implementing this. It does seem to work fine here now.
One minor detail is that the subfolders of the other users folder aren't directly visible after the other users folder is added (with the option to retrieve subfolders checked). The subfolders only becomes visible after a restart of evolution.
Comment 15 Milan Crha 2012-11-19 09:53:52 UTC
(In reply to comment #14)
> One minor detail is that the subfolders of the other users folder aren't
> directly visible after the other users folder is added (with the option to
> retrieve subfolders checked). The subfolders only becomes visible after a
> restart of evolution.

Yes, that's correct, that's what I meant with:
> Now, the "Include subfolders" makes the EWS camel provider check folder
> structure on a foreign folder, always after the provider connects to
> the server (it might be enough to go offline and online to get folder
> structure changes), and provides hierarchy of subfolders for the selected
> foreign user.
Comment 16 Milan Crha 2012-11-19 11:47:56 UTC
Oh, thanks for the ping on IRC, I misunderstood your comment. I see what you mean now, the structure is not fetched right after the folder is subscribed. I also noticed that unsubscribe doesn't unsubscribe subfolders for folders with "Include subfolders", which is a bug as well. I'm reopening this once again.
Comment 17 Milan Crha 2012-11-19 16:17:51 UTC
Created attachment 229380 [details] [review]
ews patch ]I[

for evolution-ews;

This addresses both issues, if a folder is subscribed with subfolders, then the list of subfolders is fetched right after the folder is subscribed (it's not done immediately, but as a task, which is scheduled to be done once other piled tasks are done). This also fixes the unsubscribe issue I mentioned above.

And I know why I didn't notice the issue with initial fetch. When the unsubscribe was called, the folders were removed from UI, but left in the background, thus the next subscribe to the same folder showed also old subfolders. With unsubscribe fixed I saw also the initial fetch issue.
I should be more careful next time.
Comment 18 Milan Crha 2012-11-19 16:23:30 UTC
Created commit ba3912b in ews master (3.7.3+)
Comment 19 Erik van Pienbroek 2012-11-30 22:58:45 UTC
I just tested the latest ews master and all issues mentioned in this ticket are resolved now. The initial fetch of the folder structure (including subfolders) and browsing through the mail folders of an other user work perfect now. Thank you very much for your help!