Kamal Rathnayake
Kamal Rathnayake

Reputation: 582

Outlook Mail addin reading body content error

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?

Upvotes: 0

Views: 473

Answers (1)

Jason Johnston
Jason Johnston

Reputation: 17692

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);
  }
);

Upvotes: 3

Related Questions