none
Where to go for help on boarding to Office 365 development? RRS feed

  • Question

  • I want to get started writing apps for Office 365, but the very first tutorial won't work for me.

    Getting Started: https://msdn.microsoft.com/office/office365/howto/getting-started-Office-365-APIs?javascript

    I'm sure I've written the code as directed, and I've double checked the instructions.  Nevertheless, when I run my locally hosted one page app in Chrome, I get this error:

    XMLHttpRequest cannot load https://outlook.office365.com/api/v1.0/me/messages. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8080' is therefore not allowed access. The response had HTTP status code 400.

    Well, adal.js is supposed to take care of that, right?

    I sure will appreciate some guidance on this, so, thanks.

    Here is the javascript console output, starting with the last good log message, it was all good up to here, then:

    Fragment has access token
    https://outlook.office365.com/api/v1.0/me/messages Failed to load resource: the server responded with a status of 400 (Bad Request)
    (index):1 XMLHttpRequest cannot load https://outlook.office365.com/api/v1.0/me/messages. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8080' is therefore not allowed access. The response had HTTP status code 400.
    angular.js:12330 HTTP request to Mail API failed.(anonymous function) @ angular.js:12330
    https://outlook.office365.com/api/v1.0/me/messages Failed to load resource: the server responded with a status of 400 (Bad Request)
    (index):1 XMLHttpRequest cannot load https://outlook.office365.com/api/v1.0/me/messages. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8080' is therefore not allowed access. The response had HTTP status code 400.
    angular.js:12330 HTTP request to Mail API failed.

    Thursday, September 3, 2015 5:28 PM

Answers

  • Thank you, David, I was wondering about that clause myself, and I really appreciate your time and effort, but it turns out that is not the problem.  I don't happen to have access to a modern IE.  

    OK, I learned something.  I thought I'd work on the OAuth sandbox and see what I could get.  When I tried that same GET for messages in the URL above  the response was not the same error, but a message along the lines of users without mailboxes can't ask for messages.  I had been wondering about the fact that I had no email messages, but I expected a message along those lines, not CORS failure.  So, in O365 I had to go and give myself a license, which I never would have known without some help, to have a mailbox and then send myself some email.  Then the Getting Started script started working.  Hooray.

    So, the tutorial needs a part about how to set up some dummy data, if the developer needs it.


    • Marked as answer by woznotharry Thursday, September 10, 2015 5:09 PM
    Thursday, September 10, 2015 5:09 PM

All replies

  • We are doing the research about your problem. There might be some delay about the response. Appreciate your patience.
    Monday, September 7, 2015 1:42 AM
  • Thank you.  How can I help you look into it?  Would some account information be helpful?
    Tuesday, September 8, 2015 9:13 PM
  • >>>XMLHttpRequest cannot load https://outlook.office365.com/api/v1.0/me/messages. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8080' is therefore not allowed access. The response had HTTP status code 400.

    In this sentence "SimpleMailApp that uses the Active Directory Authentication Library (ADAL) for JavaScript to authenticate a user and REST calls to retrieve that user's email using cross-origin resource sharing (CORS)."

    I find this note "Internet Explorer must use Internet Explorer 11 with MS15-032: Cumulative security update for Internet Explorer (KB3038314) installed for this sample to work" about using cross-origin resource sharing (CORS).

    I suspect that this issue maybe is caused by Browser, so I suggest that you could try it again with Internet Explorer to make sure whether Chrome browser caused this issue.

    Thursday, September 10, 2015 9:03 AM
  • Thank you, David, I was wondering about that clause myself, and I really appreciate your time and effort, but it turns out that is not the problem.  I don't happen to have access to a modern IE.  

    OK, I learned something.  I thought I'd work on the OAuth sandbox and see what I could get.  When I tried that same GET for messages in the URL above  the response was not the same error, but a message along the lines of users without mailboxes can't ask for messages.  I had been wondering about the fact that I had no email messages, but I expected a message along those lines, not CORS failure.  So, in O365 I had to go and give myself a license, which I never would have known without some help, to have a mailbox and then send myself some email.  Then the Getting Started script started working.  Hooray.

    So, the tutorial needs a part about how to set up some dummy data, if the developer needs it.


    • Marked as answer by woznotharry Thursday, September 10, 2015 5:09 PM
    Thursday, September 10, 2015 5:09 PM