diff --git a/ActiveSync/SOGoActiveSyncDispatcher.m b/ActiveSync/SOGoActiveSyncDispatcher.m
index 833538e25..ab4157e01 100644
--- a/ActiveSync/SOGoActiveSyncDispatcher.m
+++ b/ActiveSync/SOGoActiveSyncDispatcher.m
@@ -3077,7 +3077,8 @@ void handle_eas_terminate(int signum)
folderIdentifiers = [NSMutableArray array];
// Android 6 will send search requests with no collection ID - so we search in all folders.
- if (!folderId)
+ // Outlook Mobile App sends search requests with CollectionId=0 - We treat this as an all-folder-search.
+ if (!folderId || [folderId isEqualToString: @"0"])
{
NSArray *foldersInCache;
SOGoCacheGCSObject *o;
@@ -3145,7 +3146,7 @@ void handle_eas_terminate(int signum)
[s appendFormat: @"%@+%@", folderId, itemId];
[s appendFormat: @"%@", folderId];
[s appendString: @""];
- [s appendFormat: [mailObject activeSyncRepresentationInContext: context]];
+ [s appendString: [mailObject activeSyncRepresentationInContext: context]];
[s appendString: @""];
[s appendFormat: @""];
}
@@ -3948,6 +3949,8 @@ void handle_eas_terminate(int signum)
[map setObject: [currentAttachment objectForKey: @"mimetype"] forKey: @"content-type"];
[map setObject: [currentAttachment objectForKey: @"encoding"] forKey: @"content-transfer-encoding"];
[map addObject: [NSString stringWithFormat: @"attachment; filename=\"%@\"", [currentAttachment objectForKey: @"filename"]] forKey: @"content-disposition"];
+ if ([[currentAttachment objectForKey: @"bodyId"] length])
+ [map setObject: [currentAttachment objectForKey: @"bodyId"] forKey: @"content-id"];
bodyPart = [[[NGMimeBodyPart alloc] initWithHeader: map] autorelease];
fdata = [[NGMimeFileData alloc] initWithBytes:[bodydata bytes] length:[bodydata length]];
diff --git a/NEWS b/NEWS
index 42d78bc54..4c5970b09 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@ Bug fixes
- [web] don't encode filename extension when exporting folders
- [core] don't always fetch the sorting columns
- [eas] strip '<>' from bodyId and when forwarding mails
+ - [eas] fix search on for Outlook application (#4605 and #4607)
4.0.4 (2018-10-23)
------------------