## Other Users' Folders

Most operations concerning other users' folders are handled by `ExchangeHierarchyForeign`, with some help from `ExchangeAccount`.

When the user first tries to add another user's folder, `ExchangeAccount` looks up the user in the Global Catalog, passing the `E2K_GLOBAL_CATALOG_LOOKUP_EMAIL` and `E2K_GLOBAL_CATALOG_LOOKUP_MAILBOX` flags to `e2k_global_catalog_lookup()`. The `exchange_server` and `mailbox` fields in the returned `E2kGlobalCatalogEntry` are then used to construct a URL (using the account's SSL settings).

### Note

(One problem with this approach is that the returned `exchange_server` is not guaranteed to be running OWA. See Bug 258526.)

`ExchangeAccount` then creates an `ExchangeHierarchyForeign` from that data, and asks it to subscribe to the requested folder. `ExchangeHierarchyForeign` looks for the folder in two different ways. First, it tries using the literal folder name that the user provided.

If that fails, and if the folder name is one of the default folder names (eg, "Calendar"), then it tries looking up the `urn:schemas:httpmail:` property for that folder (eg, `urn:schemas:httpmail:calendar`) on the other user's mailbox. (Specifically, it looks for the property on the invisible `/NON_IPM_SUBTREE` subdirectory of the user's mailbox, because the property won't be readable on the top-level directory unless the user has permission to read the top-level directory.) This allows the folder to be found even if it has a localized name (eg, "Calendario").

### Private items

Outlook allows the user to mark items in folders as "private". (Evolution allows this in Calendar and Task folders, but not Contact or Mail folders.) Private items are not supposed to show up when other users view the folder, unless they have been given explicit permission to view private items in the Delegates dialog. However, Exchange does not actually enforce this itself, so we have to work around this.