0
votes

I'm trying to develop an Outlook mail addin to access the body content of an email.

This is how I'm writing the JavaScript code to according to the Documentation provided by MSDN.

        Office.context.mailbox.item.body.getAsync("html", function(result){

            $("#mytext3").val(result);

        });

When I debug this with chrome, This is the error message I found.

Uncaught Sys.ArgumentException: Sys.ArgumentException: Value does not fall within the expected range.

Parameter name: options

What am I doing wrong?

1

1 Answers

3
votes

The call should work (I just tried it), but the result passed to your callback is an object, with the body in result.value.

You could try passing an options parameter, something like:

Office.context.mailbox.item.body.getAsync(
  "html", 
  { asyncContext: "This is passed to the callback" },
  function(result){
    $("#mytext3").val(result.value);
  }
);