Outlook and folders under INBOX
Open, 60Public

Description

Outlook 2013 + ActiveSync support folders under INBOX. That is probably what is not supported by Kolab with Syncroton and Cyrus IMAP. In such a case there is an expectation that when Outlook+ActiveSync is connected to Kolab Server user will get an error when trying to create folder under Inbox. That is not the case. Outlook successfully creates that Inbox subfolder, but it is not in any way reflected on IMAP server.
Syncroton imap log contains:

[03-Feb-2017 12:56:55,347724 +0200]: [685D] C: A0006 LIST "" "INBOX/subfolder inbox"
[03-Feb-2017 12:56:55,348568 +0200]: [685D] S: A0006 OK Completed (0.000 secs)
[03-Feb-2017 12:56:55,348834 +0200]: [685D] C: A0007 CREATE "INBOX/subfolder inbox"
[03-Feb-2017 12:56:55,349498 +0200]: [685D] S: A0007 NO Invalid mailbox name
[03-Feb-2017 12:56:55,350242 +0200]: [685D] C: A0008 LOGOUT

and console log contains

[03-Feb-2017 12:56:45,484146 +0200]: Cmd=Sync&User=example.bandymui@example.lt&DeviceId=7EE38D73F45C4EFA8361546F84C1E5CA&DeviceType=WindowsOutlook15 [27.5/51.6]: 64.0916 sec
[03-Feb-2017 12:56:55,267840 +0200]: [DEBUG] Syncroton_Server::handle::62 REQUEST METHOD: POST
[03-Feb-2017 12:56:55,267985 +0200]: [DEBUG] Syncroton_Server::_handlePost::104 REQUEST Array
(
    [protocolVersion] => 14.0
    [command] => FolderCreate
    [deviceId] => 7EE38D73F45C4EFA8361546F84C1E5CA
    [deviceType] => WindowsOutlook15
    [policyKey] => 
    [saveInSent] => 
    [collectionId] => 
    [itemId] => 
    [attachmentName] => 
    [acceptMultipart] => 
    [userAgent] => Outlook/15.0 (15.0.4893.1000; MSI; x86)
    [contentType] => application/vnd.ms-sync.wbxml
)

[03-Feb-2017 12:56:55,329503 +0200]: [DEBUG] Syncroton_Server::_handlePost::127 xml request:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/">
<FolderCreate xmlns="uri:FolderHierarchy">
  <SyncKey>6</SyncKey>
  <ParentId>38b950ebd62cd9a66929c89615d0fc04</ParentId>
  <DisplayName>subfolder inbox</DisplayName>
  <Type>12</Type>
</FolderCreate>

[03-Feb-2017 12:56:55,329741 +0200]: [DEBUG] Syncroton_Command_Wbxml::__construct::163 sync timestamp: 2017-02-03 12:56:55
[03-Feb-2017 12:56:55,329946 +0200]: [DEBUG] Syncroton_Command_FolderCreate::handle::40 synckey is 6
[03-Feb-2017 12:56:55,332167 +0200]: [DEBUG] Syncroton_Command_FolderCreate::handle::49 parentId: 38b950ebd62cd9a66929c89615d0fc04 displayName: subfolder inbox
[03-Feb-2017 12:56:55,351555 +0200]: Cmd=FolderCreate&User=example.bandymui@example.lt&DeviceId=7EE38D73F45C4EFA8361546F84C1E5CA&DeviceType=WindowsOutlook15 [2.9/3.0]: 0.9173 s
ec
[03-Feb-2017 12:56:55,426676 +0200]: [DEBUG] Syncroton_Server::handle::62 REQUEST METHOD: POST
[03-Feb-2017 12:56:55,426817 +0200]: [DEBUG] Syncroton_Server::_handlePost::104 REQUEST Array
(
    [protocolVersion] => 14.0
    [command] => FolderSync
    [deviceId] => 7EE38D73F45C4EFA8361546F84C1E5CA
    [deviceType] => WindowsOutlook15
    [policyKey] => 
    [saveInSent] => 
    [collectionId] => 
    [itemId] => 
    [attachmentName] => 
    [acceptMultipart] => 
    [userAgent] => Outlook/15.0 (15.0.4893.1000; MSI; x86)
    [contentType] => application/vnd.ms-sync.wbxml
)

[03-Feb-2017 12:56:55,430532 +0200]: [DEBUG] Syncroton_Server::_handlePost::127 xml request:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/">
<FolderSync xmlns="uri:FolderHierarchy">
  <SyncKey>6</SyncKey>
</FolderSync>

[03-Feb-2017 12:56:55,430687 +0200]: [DEBUG] Syncroton_Command_Wbxml::__construct::163 sync timestamp: 2017-02-03 12:56:55
[03-Feb-2017 12:56:55,430808 +0200]: [DEBUG] Syncroton_Command_FolderSync::handle::80 synckey is 6
[03-Feb-2017 12:56:55,466754 +0200]: [DEBUG] Syncroton_Server::_handlePost::177 xml response(0):
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/">
<FolderSync xmlns="uri:FolderHierarchy" xmlns:Syncroton="uri:Syncroton">
  <Status>1</Status>
  <SyncKey>6</SyncKey>
  <Changes>
    <Count>0</Count>
  </Changes>
</FolderSync>

[03-Feb-2017 12:56:55,469549 +0200]: Cmd=FolderSync&User=example.bandymui@example.lt&DeviceId=7EE38D73F45C4EFA8361546F84C1E5CA&DeviceType=WindowsOutlook15 [3.0/4.3]: 0.0968 sec
[03-Feb-2017 12:56:55,657684 +0200]: [DEBUG] Syncroton_Server::handle::62 REQUEST METHOD: POST
[03-Feb-2017 12:56:55,657853 +0200]: [DEBUG] Syncroton_Server::_handlePost::104 REQUEST Array
(
    [protocolVersion] => 14.0
    [command] => Sync
    [deviceId] => 7EE38D73F45C4EFA8361546F84C1E5CA
    [deviceType] => WindowsOutlook15
    [policyKey] => 
    [saveInSent] => 
    [collectionId] => 
    [itemId] => 
    [attachmentName] => 
    [acceptMultipart] => 
    [userAgent] => Outlook/15.0 (15.0.4893.1000; MSI; x86)
    [contentType] => application/vnd.ms-sync.wbxml
)

At least that is what I could find. So it looks like Syncroton fails to create folder, but does not inform user about that. That makes a wrong impression that folder was created, but it was not.

Details

Ticket Type
Task
adomaitis created this task.Feb 3 2017, 2:23 PM
adomaitis assigned this task to machniak.Feb 3 2017, 2:31 PM
adomaitis added a project: Syncroton.

Looks like you are right. There's a TODO entry in the folder creation code to throw exception on error, but it's not implemented and indeed no error is returned to the client. However, throwing an exception here is not enough, we need some more code in the Syncroton library itself to handle nicely the exception (returning properly formatted response instead of just a http error).

Note to myself: See https://msdn.microsoft.com/en-us/library/gg651087(v=exchg.80).aspx for list of possible error status codes. Looks like code 3 might suit the best this case, but there are a few other cases that we might want to distinguish in error code.

@adomaitis I'm testing a fix and can't make Outlook display an error. I tried valid ActiveSync response with different error codes and even http error 500. In all cases Outlook just ignores the error and displays the folder as any other folder. So, while I'll commit the change it looks that it's not possible to tell Outlook the operation failed.

Outlook and MS ... why I'm not surprised ...
let me know about the commit, I will try on my side.

@adomaitis, committed 1d7e1237f2d to master. I don't know if there's anything more we can do here.

pasik added a subscriber: pasik.Nov 25 2017, 2:32 PM

Wouldn't the simple solution to be allow folders to be created as subfolders of INBOX @machniak

I know Cyrus IMAP doesn't block this as default, and so if a user chooses to creates subfolders as childern of INBOX, why can't he? @vanmeeuwen

This is the what a lot of users on Exchange do, and so if they were to migrate to Kolab, it would be a pain migrating folders manually.