Hello,
I am trying to find some sample code that will allow me to query
Google Calendar via .net API interface. I am able to query when I
don't have Proxy server. But unable to do it when behind the proxy
server. I have modified the query to take credentials for proxy server
but some how I can't get my code working. Can you please help me
out... I have spend 2 days in this problem and I am still unable to
resolve.
It would be nice, if some body has a working copy of a program that
goes thru Proxy Server. Because I did many search and did not find a
working copy.
Thanks in advance.
Dipankar Biswas
Here is my code :
=============
using System;
using System.Collections;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Net;
using Google.GData.Client;
using Google.GData.Extensions;
using Google.GData.Calendar;
namespace googleAp01
{
class Program
{
static void Main(string[] args)
{
string calendarURI = "http://www.google.com/calendar/feeds/
[EMAIL PROTECTED]/private/full";
string userName = "[EMAIL PROTECTED]";
string passWord = "MyGooglePassowrdGoesHere";
string proxyAddress = "http://MyProxyURL:8080";
string proxyuserName = "MyProxyUserID";
string proxypassWord = "MyProxyPassword";
Console.WriteLine(calendarURI);
Console.WriteLine(userName);
Console.WriteLine(passWord);
CalendarService s = new CalendarService("CalendarTest");
s.setUserCredentials(userName, passWord);
EventQuery query = new EventQuery();
query.Uri = new Uri("http://www.google.com/calendar/feeds/
[EMAIL PROTECTED]/private/full");
query.StartTime = DateTime.Now.AddDays(-28);
query.EndTime = DateTime.Now.AddMonths(6);
GDataRequestFactory f =
(GDataRequestFactory)s.RequestFactory;
IWebProxy iproxy = WebRequest.DefaultWebProxy;
WebProxy myproxy = new
WebProxy(iproxy.GetProxy(query.Uri));
myproxy.Credentials = CredentialCache.DefaultCredentials;
myproxy.UseDefaultCredentials = true;
f.Proxy = myproxy;
EventFeed calFeed = s.Query(query) as EventFeed;
// now populate the calendar
while (calFeed != null && calFeed.Entries.Count > 0)
{
// look for the one with dinner time...
foreach (EventEntry entry in calFeed.Entries)
{
Console.WriteLine(entry);
}
}
}
}
}
==============================
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Calendar Data API" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---