diff --git a/ActiveSync/SOGoActiveSyncDispatcher.m b/ActiveSync/SOGoActiveSyncDispatcher.m
index ac9a7e143..3e57221c3 100644
--- a/ActiveSync/SOGoActiveSyncDispatcher.m
+++ b/ActiveSync/SOGoActiveSyncDispatcher.m
@@ -3103,7 +3103,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;
@@ -3171,7 +3172,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: @""];
}
@@ -3939,6 +3940,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 43cddc3f9..680b9db92 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@
Bug fixes
- [eas] strip '<>' from bodyId and when forwarding mails
+ - [eas] fix search on for Outlook application (#4605 and #4607)
4.0.1 (2018-07-10)
------------------