OfficeDev / Outlook-Add-in-On-Send

Learn how to check for restricted words in an Outlook email message body, add a recipient to the CC line and check that there is a subject in the email on send.
MIT License
35 stars 31 forks source link

mailboxItem is always empty. #12

Open nitro-marky opened 4 years ago

nitro-marky commented 4 years ago

I've been able to get the ItemSend event to fire my function, at the moment I currently block the message from sending just to check that I am getting all of the message data but it is always empty.

In the manifest: `

` In the FunctionFile: `Office.initialize = function (reason) { $(document).ready(function () { mailboxItem = Office.context.mailbox.item; console.log("Page Ready"); console.log(reason); }); }; function MessageSent(event) { console.log(Office.context.mailbox.item.to); console.log(event); //stop the message from sending to get the data //event.completed({ allowEvent: true}); }` All I get from the console for the 'to' field I get this: `r.ComposeRecipient {_type$p$0: 0, _propertyName$p$0: "to"} _propertyName$p$0: "to" _type$p$0: 0 __proto__: addAsync: ƒ (n) constructor: ƒ (n,t) getAsync: ƒ () setAddHelper: ƒ (n,t,i) setAsync: ƒ (n) _propertyName$p$0: null _type$p$0: 0 __proto__: Object` Anyone have any ideas why I cannot retrieve the message data? ![image](https://user-images.githubusercontent.com/35331926/67772655-57deeb00-fa52-11e9-977d-98233f698bf8.png)