none
Ajax calls in mail app not called from Outlook 2013 desktop software RRS feed

  • Question

  • Hello,

    My mail app works fine in the web outlook, in all browsers, including IE. When I try use my mail app from the Outlook 2013 desktop app, my ajax requests fail to call the server. Am I missing something? Does the Outlook 2013 desktop application use IE to render the mail apps?

    Thanks.

    Friday, March 8, 2013 11:16 PM

Answers

  • Ok, problem solved.

    I'm developing my office mail app using the MVC framework. The problem was solved when I changed my main page from a razor view to static html! As I mentioned before, the problem only exists in the Outlook desktop application, and NOT the web outlook.



    Tuesday, March 12, 2013 9:58 PM

All replies

  • I am having no problems with this. Can you please post a sample of code on how your ajax calls are made? (dataType, url address you are calling, ...). Also you can try to add

    $.ajax( url, {
        ...
        error: function (jqXHR, testStatus, errorThrown) {
            // debug here and look at the variable values
        });


    Anze Javornik

    Saturday, March 9, 2013 1:56 AM
  • Hi Anze,

    Thanks. Actually, it doesn't seem to be running any Javascript at all! 

    I'm running the app from my local machine and the pages reference the resources files (js, css) by relative path, could it be that the Outlook desktop application requires absolute/full path ? 

    Monday, March 11, 2013 7:36 PM
  • Hi Amre,

    Are you testing this via Visual Studio 2012 or Napa? Can you try a very simple repro first in VS or Napa, to see if you can get your basic JS working?

    -Andrew

    Monday, March 11, 2013 9:18 PM
  • Relative url path should not play any role with this. So you are saying even Office.initialize method is not beeing called? If not and you have no problems in OWA, then i would suggest you try to run debug in VS2012 using Outlook application instead of OWA and see if maybe they differ in javascript parser (if maybe there is an error in javascript which browser in Outlook cannot pass through and thus stops all scripts)


    Anze Javornik

    Monday, March 11, 2013 9:31 PM
  • Hi Andrew and Anze,

    I'm debugging in VS 2012. It seems like the problem is in office.js. It fails to initialize office. 

    Here is the javascript error I get when I try to lunch my app from office 2013 preview desktop application:

    JS error image

    Thanks.

    Tuesday, March 12, 2013 5:21 PM
  • I dont think that the problem is Office.js library....i got the same error few times when the error was actaully in my script. You can try and import this version of js library, but i  think that wont solve the issue:

    <script src="https://appsforoffice.microsoft.com/lib/1.0/hosted/office.js" type="text/javascript"></script>

    Maybe open developer tool in IE (F12) or try some other browser to debug your app in owa and look for errors or warnings reported by browser...or comment everything except for a simple js debug call in Office.initialize and with process of elimintaion track the bug.

    If there is still an error even if you do not include any local script files and only js you have is a debug code in office.initialize, then update the local office.js library you have.


    Anze Javornik

    Tuesday, March 12, 2013 6:17 PM
  • Ok, problem solved.

    I'm developing my office mail app using the MVC framework. The problem was solved when I changed my main page from a razor view to static html! As I mentioned before, the problem only exists in the Outlook desktop application, and NOT the web outlook.



    Tuesday, March 12, 2013 9:58 PM
  • This post is exactly what I was looking for it is a great help!!!

    Thanks,
    DG
    Wednesday, March 13, 2013 10:59 AM