简体   繁体   中英

Add event to custom calendar in Outlook

How can I add enevt to my custom calendar in outlook using Live SDK for .NET? In documentation you add event only to default calendar, not custom.

    private async void btnCreateEvent_Click(object sender, RoutedEventArgs e)
    {
    try
    {
        var calEvent = new Dictionary<string, object>();
        calEvent.Add("name", "Family Dinner");
        calEvent.Add("description", "Dinner with Cynthia's family");
        calEvent.Add("start_time", "2012-04-07T01:30:00-08:00");
        calEvent.Add("end_time", "2012-04-07T03:00:00-08:00");
        calEvent.Add("location", "Coho Vineyard and Winery, 123 Main St., Redmond WA 19532");
        calEvent.Add("is_all_day_event", false);
        calEvent.Add("availability", "busy");
        calEvent.Add("visibility", "public");
        LiveConnectClient liveClient = new LiveConnectClient(this.session);
        LiveOperationResult operationResult = await liveClient.PostAsync("me/events", calEvent);
        dynamic result = operationResult.Result;
        this.infoTextBlock.Text = string.Join(" ", "Created event:", result.name, "ID:", result.id);
    }
    catch (LiveConnectException exception)
    {
        this.infoTextBlock.Text = "Error creating event: " + exception.Message;
    }
}

I tried to replace path "me/events" by calendar id, but it doesnt work.

you said:

I tried to replace path "me/events" by calendar id, but it doesnt work.

and you were one centimeter close !!

you should have replaced "me/events" by "CALENDAR_ID/events"

I came to this question after I asked here in SO and I answered it after reading the MSFT forum

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM