locked
how to use live connect api for calender

    General discussion

  • hi,

        I need to use the live connect API to use calender for appointment in WINJS.

     My app is still in development stage. Should i register my app for live connect API to use the calender.  give a sample code that how to use the live connect API of calender in WINJS for saving the appointment.

    Thanks

    Wednesday, January 30, 2013 12:58 PM

All replies

  • You'll first need the Live SDK from http://go.microsoft.com/fwlink/p/?LinkId=224535. The go through the Live Connect Developer Guide on http://msdn.microsoft.com/en-us/library/live/hh243641, which gives you the necessary background stuff as well as then code samples for using Hotmail's calendar (specifically at http://msdn.microsoft.com/en-us/library/live/hh243641#hotmail).

    Further details on the Hotmail API are then found on http://msdn.microsoft.com/en-us/library/live/hh826535.aspx with calendar specifics on http://msdn.microsoft.com/en-us/library/live/hh826523.aspx.

    As indicated early in the Developer Guide (in the section "Getting Started"), you'll need to go to the Windows Store dashboard to get your app connected.

    Kraig

    Author, Programming Windows 8 Apps with HTML, CSS, and JavaScript, a free ebook from Microsoft Press


    Wednesday, January 30, 2013 5:45 PM
  • i already gone through these links.

    i want to know that how to save appointment in calender using these live connect api.

    Like in windows phone there is method like SaveAppointment task  which is used for saving the appointment ... same thing i want to do in winjs ...


    singh123456

    Thursday, January 31, 2013 6:31 AM
  • Is that not on http://msdn.microsoft.com/en-us/library/live/hh826523.aspx#cal_javascript, under the headings "Creating calendar events in JavaScript" and "Updating calendar events in JavaScript"? You need to use WL.api to make the calls as there isn't a dedicated function in the Live SDK for that, it seems.
    Thursday, January 31, 2013 8:54 PM
  • hi kraig,

                i am doing like this:

    function fn_load(){

     WL.init();
        WL.login({ scope: "wl.events_create" }).then(
        function (response) {
        createEvent();
        },
        function (response) {
            log("Could not connect, status = " + response.status);
        }
    );
        function createEvent() {
            var startTime = new Date();
            var endTime = new Date(startTime.getTime() + (60 * 60 * 1000));

            log("Start time: " + startTime);
            log("End time: " + endTime);

            WL.api({
                path: "/me/events",
                method: "POST",
                body: {
                    name: "I-exceed technology solution pvt. ltd.",
                    description: "Software Product based company",
                    start_time: startTime,
                    end_time: endTime,
                    location: "Koramangla,Banglore",
                    is_all_day_event: false,
                    availability: "busy",
                    visibility: "public"
                }
            }).then(
                function (response) {
                    log("Successfully created event. Response: " + JSON.stringify(response).replace(/,/g, "\n"));
                },
                function (response) {
                    log("Could not create event: " + JSON.stringify(response.error).replace(/,/g, "\n"));
                }
            );
        }
        function log(message) {
            var child = document.createTextNode(message);
            var parent = document.getElementById('JsOutputDiv') || document.body;
            parent.appendChild(child);
            parent.appendChild(document.createElement("br"));
        }
    }

    when i am calling the fn_load function then login screen is coming after saving the login info ...i am getting like: 

    could not connect, status :undefined

    ??


    singh123456

    Friday, February 01, 2013 5:18 AM
  • Curious. I dropped your code into a test app I have using LiveConnect and it worked fine--success all the way through.

    Two thing I'm curious about:

    1. Perhaps you also need the wl.signin scope in your login call? The app I'm using has used that.
    2. I'm assuming that you've registered the app with Live Connect as described on http://msdn.microsoft.com/en-us/library/live/hh826541? Also visit https://df.account.live.com/Permissions when logged into your profile and see if your app is there. I can see that if you haven't done the configuration step, then this would be failing.

    Beyond that, you've hit the limit of my experience with Live Connect, and you'd want to take your question over to the Live Connect forum instead.

    .Kraig

    Saturday, February 02, 2013 12:32 AM
  • hi kraig,

                I am using wl.signin scope ..and i am able to login as well... so after logged in am getting the above error..

                and   i haven't register my app with live Connect  as described on http://msdn.microsoft.com/en-us/library/live/hh826541

               when i am reaching on the this link then from there i am going on the Windows Store Dashboard. then it  says for payment. so will i have to pay to use the live connect API......


    singh123456



    • Edited by singh123456 Monday, February 04, 2013 7:24 AM
    Monday, February 04, 2013 6:57 AM
  • Yes, you have to have a Windows Store account, and not only a developer license from Visual Studio, to obtain the necessary authentication keys to use Live Connect.
    Tuesday, February 05, 2013 4:52 PM