Created
March 4, 2020 21:53
-
-
Save davecra/2d14d48fd75f11b65053e7b75378e3e6 to your computer and use it in GitHub Desktop.
EasyEws resolveRecipient sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function run() { | |
var msg = Office.context.mailbox.item; | |
msg.to.getAsync(function(asyncResult) { | |
if(asyncResult.status == Office.AsyncResultStatus.Failed) { | |
$("#recipientResult").text(asyncResult.error); | |
} else { | |
/** @type {Office.EmailAddressDetails[]} */ | |
var recips = asyncResult.value; | |
// are there any recipients at all | |
if(recips == null || recips.length == 0) { | |
$("#recipientResult").html("NO RECIPIENTS"); | |
} else { | |
/** @type {string} */ | |
var info = "<br/>DISPLAY NAME: " + recips[0].displayName + "<br/>" + | |
"EMAIL_ADDRESS: " + recips[0].emailAddress + "<br/>" + | |
"RECIPIENT_TYPE: " + recips[0].recipientType; | |
easyEws.resolveRecipient(recips[0].emailAddress, function(result) { | |
if(result == null || result.length == 0) { | |
info += "<br/>UNRESOLVED</br>"; | |
} else { | |
info += "<br/>RESOLVED: " + result[0].MailBoxType; | |
info += "<br/>RESOLVED EMAIL: " + result[0].EmailAddress; | |
} | |
// write tot he form | |
$("#recipientResult").html(info); | |
}, function(error) { | |
$("#recipientResult").text(error); | |
}, function(debug) { | |
$("#debugResult").text(debug) | |
}); | |
} | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment