--- /dev/null
+#!/usr/bin/env bash
+
+user=samir.benmendil@ultrahaptics.com
+pass=$(pass ultrahaptics/okta.com/samir.benmendil@ultrahaptics.com)
+url="https://outlook.office365.com/EWS/Exchange.asmx"
+
+read -r -d '' data <<EOF
+<?xml version="1.0" encoding="utf-8"?>
+<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
+    xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
+    <soap:Body>
+        <ResolveNames 
+            xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
+            xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
+            ReturnFullContactData="true">
+            <UnresolvedEntry>$1</UnresolvedEntry>
+        </ResolveNames>
+    </soap:Body>
+</soap:Envelope>
+EOF
+
+out=$(curl -s -u "$user:$pass" -L "$url" -d "$data")
+
+readarray -t email < <(echo $out | xpath -q -e '//t:Mailbox/t:EmailAddress/text()')
+readarray -t name  < <(echo $out | xpath -q -e '//t:Contact/t:DisplayName/text()')
+
+count=${#email[@]}
+
+if [[ "$count" -eq 0 ]]; then
+    echo "No matches"
+    exit 1
+fi
+
+echo "$count matches"
+for (( i = 0; i < $count; i++ )); do
+    echo -e "${email[$i]}\t${name[$i]}\t"
+done
 
 unset record                        # do not move sent msgs to a folder, gmail does that
 unset move                          # do not move read msgs, gmail does that
 
+# goobook
+set query_command = "goobook query '%s'"
+
 mailboxes "+gmail/inbox"
 mailboxes "+gmail/sent"
 mailboxes "+gmail/youtube"
 
 unset record                        # do not move sent msgs to a folder, gmail does that
 unset move                          # do not move read msgs, gmail does that
 
+# office365
+set query_command = "office365-book"
+
 mailboxes "+office365/inbox"
 mailboxes "+office365/sent"
 mailboxes "+office365/archive"
 
 # send clacks
 my_hdr X-Clacks-Overhead: GNU Terry Pratchett
 
-# goobook
-set query_command = "goobook query '%s'"
-
 # sort/threading
 set sort              = threads
 set sort_aux          = last-date-received