It has been a while since I have updated this library, however I have had a few requests.
The first one that I am publishing today is adding the ResolveNames operation. The latest is now on GitHub here. And you can install it using NPM like this:
npm install easyews
Also, I have updated the CDN listing. Before I was using RAWGIT but that has been retired. You can now add the CDN like this:
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
<html> | |
<head> | |
<!– DEBUG –> | |
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/davecra/easyEws/easyEws.js"></script> | |
<!– Or, MINIFIED –> | |
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/davecra/easyEws/easyEws.min.js"></script> | |
</head> | |
</html> |
To issue a resolve names you will pass the email address or the display name to the function like this:
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) | |
}); | |
} | |
} | |
}); | |
} |
If you have any suggestions for this library, please ping me.
[…] yesterday with easyEws, it has been a while since I have touched this library. I updated it yesterday with a quick fix and […]