locked
How to use LIveSDK in BackgroundTask?

    Question

  • I want to use the LiveSDKHTML to read information from the calendar using a BackgroundTask which fires every 15 minutes. This will update the application tile at appropriate times.

    I believe I need to import the LiveSDKHTML/js/wl.js file with

    importScripts("///LiveSDKHTML/js/wl.js");

    The file is LIveSDK is imported but it fails with "window is undefined", which makes sense since this is a background task.

    How do I use the LiveSDK in a BackgroundTask?

    Wednesday, March 12, 2014 4:23 AM

Answers

  • Hi Ross,

    The error message display because you are working at a background Task.

    Web Workers use the postMessage function to communicate with the UI thread. By the help of Web Worker you can import the scripts even you are working with a non-UI thread.

    Take a look at JavaScript Web Workers app multithreading sample if needed.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Ross Gardler Friday, March 14, 2014 9:35 PM
    Wednesday, March 12, 2014 9:47 AM
    Moderator