Forum Discussion

vijayakrishnabv's avatar
vijayakrishnabv
Occasional Contributor
2 years ago

Unable to capture outlook email content from outlook 365

 

Hi Friends,

Below code is working fine with Outlook 15, to capture email content of specific email. It stopped working when we migrate to outlook 365.

"Body" method of the code is not working (Showing as "operation aborted" in watch list for Body property), Any idea on how to resolve this issue?

 

var outlookApplication = Sys.OleObject("Outlook.Application");
var NamespaceMAPI = outlookApplication.GetNamespace("MAPI");
var inbox = NamespaceMAPI.GetDefaultFolder(Folders[folderID]); //Passing folder ID numbers
items = inbox.Items;
oBody = items.Item(i).Body;

3 Replies

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    I suggest you check the object value of items.Item(0), as Body may not belong to Item(0).

    • vijayakrishnabv's avatar
      vijayakrishnabv
      Occasional Contributor

      I did debug and no issues with item as we can see Subject of email as expected, Body information is displaying as "operation aborted" where it should display actual content of email. Not sure whether this is restriction from outlook 365 or our company specific restriction. If someone is able to access from outlook 365, it can throw some light.

      Thanks.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    It could be relating to security, i.e. no credentials provided. Since it's relating specifically to Outlook 365, it might be worth searching the internet to see if there's any possible solutions