[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Google Calendar API .NET

Posted on 2009-12-21
Medium Priority
Last Modified: 2014-11-12
I am starting at ground one with this.  I want to return a set of
calendar events for a range of dates.  I  found some sample c# code
and have a few questions.

1)  What is feedUri in the code below?  What should its value be?

static void Main(string[] args)
        userName = "joe@gmail.com";
        userPassword = "pass1234";
        feedUri = @"http://gmail.com";

2)  What is the CalendarService parameter?  What value should I

CalendarService service = new CalendarService("exampleCo-
service.setUserCredentials(userName, userPassword);

3)  The code follows.  I am getting an Invalid Credentials error

static void PrintUserCalendars(CalendarService service)
            FeedQuery query = new FeedQuery();
            query.Uri = new Uri("http://www.google.com/calendar/feeds/
            AtomFeed calFeed = service.Query(query);  //Error here -
Invalid Credentials

-- Any help would be appreciated.


Question by:lplasc
  • 2

Expert Comment

ID: 26099287
try to use this line to authenticate the user to the service

service.setUserCredentials("username", "password");
LVL 11

Accepted Solution

lenordiste earned 1400 total points
ID: 26099333
these informations are actually provided in google's dev guide, you probably over looked them so here they are:
1) "The feedUri value is typically http://www.google.com/calendar/feeds/default/private/full for working with your primary calendar"
2) "Create a new CalendarService instance, setting your application's name (in the form companyName-applicationName-versionID). "
3) you need to call "service.setUserCredentials()" with the right usernames and password before calling "Query". You probably need to double check your login info (remember to include the full user name including the domain name).

documenation reminder:

Good luck and let us know if it's not working for you !

Expert Comment

ID: 26099937
this is the same what i said

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
This Micro Tutorial  demonstrates whether your site uses one subdomain or multiple subdomains, how to create full URLs from Google Analytics content reports. This procedure is called concatenation and can also be done with the CONCATENTATE function.…
This Micro Tutorial will introduce a Google tool, which is a great way to learn more about dimensions in metrics in Google Analytics, even if you use the interface or the API.
Suggested Courses
Course of the Month20 days, 1 hour left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question