EasyEws resolveRecipient sample
This file contains 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