Skip to content

Instantly share code, notes, and snippets.

@bureado
Created March 18, 2015 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bureado/acf5009950f6c21c0fd7 to your computer and use it in GitHub Desktop.
Save bureado/acf5009950f6c21c0fd7 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" >
<!-- The title element is optional and will not be displayed anywhere. -->
<title>Sender and Recipient</title>
<!-- Add these two references to MicrosoftAjax.js and Office.js. -->
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.2.min.js"></script>
<script src="https://appsforoffice.microsoft.com/lib/1.1/hosted/Office.js" type="text/javascript"></script
</head>
<body style="margin: 4px">
<h3>Email Details</h3>
<table>
<tr><td>&nbsp;</td><td>Sender</td><td>Recipient</td></tr>
<tr><td>Display Name</td><td id="senderDisplayName" /><td id="recipientDisplayName" /></tr>
<tr><td>Email Address</td><td id="senderEmailAddress" /><td id="recipientEmailAddress" /></tr>
</table>
<script type="text/javascript">
/*
Global variables to hold references to the host application object that provides access to
the Framework APIs and the settings of your mail app.
*/
var outlook;
var settings;
/*
When the Framework is ready, the initialize() method will be called.
This method is the entry point for your code.
*/
// The initialize function is required for all apps.
Office.initialize = function () {
// Checks for the DOM to load using the jQuery ready function.
$(document).ready(function () {
// After the DOM is loaded, app-specific code can run.
mailbox = Office.context.mailbox;
settings = Office.context.roamingSettings;
$("#senderDisplayName").append(mailbox.item.sender.displayName);
$("#senderEmailAddress").append(mailbox.item.sender.emailAddress);
$("#recipientDisplayName").append(mailbox.item.to[0].displayName);
$("#recipientEmailAddress").append(mailbox.item.to[0].emailAddress);
});
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment