本文整理汇总了C#中CalendarService.setUserCredentials方法的典型用法代码示例。如果您正苦于以下问题:C# CalendarService.setUserCredentials方法的具体用法?C# CalendarService.setUserCredentials怎么用?C# CalendarService.setUserCredentials使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CalendarService
的用法示例。
在下文中一共展示了CalendarService.setUserCredentials方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GAuthenticate
private CalendarService GAuthenticate()
{
Uri oCalendarUri = new Uri("http://www.google.com/calendar/feeds/[email protected]/private/full");
//Uri oCalendarUri = new Uri("http://www.google.com/calendar/feeds/[email protected]/private/full");
//Initialize Calendar Service
CalendarService oCalendarService = new CalendarService("CalendarSampleApp");
oCalendarService.setUserCredentials(sGoogleUserName, sGooglePassword);
//Use Proxy
GDataRequestFactory oRequestFactory = (GDataRequestFactory)oCalendarService.RequestFactory;
WebProxy oWebProxy = new WebProxy(WebRequest.DefaultWebProxy.GetProxy(oCalendarUri));
oWebProxy.Credentials = CredentialCache.DefaultCredentials;
oWebProxy.UseDefaultCredentials = true;
oRequestFactory.Proxy = oWebProxy;
return oCalendarService;
}
示例2: RefreshFeed
private void RefreshFeed()
{
string calendarURI = "https://www.google.com/calendar/feeds/default/private/full";
string userName = "Test";
string passWord = "Test";
this.entryList = new ArrayList();
EventQuery query = new EventQuery();
CalendarService service = new CalendarService("CalendarSampleApp");
service.setUserCredentials(userName, passWord);
// only get event's for today - 48 months until today + ½ year
query.Uri = new Uri(calendarURI);
query.StartTime = DateTime.Now.AddMonths(-48);
query.EndTime = DateTime.Now.AddMonths(6);
EventFeed calFeed = service.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)
{
this.entryList.Add(entry);
}
// just query the same query again.
if (calFeed.NextChunk != null)
{
query.Uri = new Uri(calFeed.NextChunk);
calFeed = service.Query(query) as EventFeed;
}
else
calFeed = null;
}
}