Hi All,

code is as below:

   #region Calendar Events

        protected void btnShowGC_Click(object sender, EventArgs e)
        {
            GetCalendarEvents();
        }


        private DataTable FillDataTable()
        {
            try
            {
                DataTable dtContacts = new DataTable();
                DataColumn dtContactsCol = new DataColumn();
                dtContactsCol.ColumnName = "EventTitle";
                dtContactsCol.DataType =
System.Type.GetType("System.String");
                dtContacts.Columns.Add(dtContactsCol);

                dtContactsCol = new DataColumn();
                dtContactsCol.ColumnName = "Author";
                dtContactsCol.DataType =
System.Type.GetType("System.String");
                dtContacts.Columns.Add(dtContactsCol);

                dtContactsCol = new DataColumn();
                dtContactsCol.ColumnName = "Location";
                dtContactsCol.DataType =
System.Type.GetType("System.String");
                dtContacts.Columns.Add(dtContactsCol);

                dtContactsCol = new DataColumn();
                dtContactsCol.ColumnName = "StartTime";
                dtContactsCol.DataType =
System.Type.GetType("System.DateTime");
                dtContacts.Columns.Add(dtContactsCol);

                dtContactsCol = new DataColumn();
                dtContactsCol.ColumnName = "EndTime";
                dtContactsCol.DataType =
System.Type.GetType("System.DateTime");
                dtContacts.Columns.Add(dtContactsCol);

                return dtContacts;
            }
            catch
            {
                return null;
            }

        }


        protected void GetCalendarEvents()
        {
            try
            {
                CalendarService oSrv = new
CalendarService("GoogleAPIs_Cal_V1");
                EventQuery oQuery = new EventQuery();
                oQuery.Uri = new Uri("XXXX");

                if (strUserName != null && strUserName.Length > 0)
                {
                    oSrv.setUserCredentials(strUserName, strPwd);
                }

                oQuery.StartTime = DateTime.Now.AddHours(-11);
                oQuery.EndDate = DateTime.Now.AddDays(1);

                EventFeed calFeed = oSrv.Query(oQuery) as EventFeed;

                ArrayList dates = new ArrayList(50);

                DataTable dtEvents = FillDataTable();

                while (calFeed != null && calFeed.Entries.Count > 0)
                {
                    // look for the one with dinner time...
                    foreach (Google.GData.Calendar.EventEntry entry in
calFeed.Entries)
                    {
                        DataRow dtRow = dtEvents.NewRow();
                        dtRow["EventTitle"] = entry.Title.Text;

                        string strLoc = string.Empty;
                        string strAuth = string.Empty;

                        foreach (Where loc in entry.Locations)
                        {
                            strLoc += loc.ValueString + ";";
                        }
                        dtRow["Location"] = strLoc;

                        foreach (AtomPerson loc in entry.Authors)
                        {
                            strAuth += loc.Name + ";";
                        }
                        dtRow["Author"] = strAuth;


                        this.entryList.Add(entry);
                        if (entry.Times.Count > 0)
                        {
                            foreach (When w in entry.Times)
                            {
                                 dtRow["StartTime"] = w.StartTime;
                                 dtRow["EndTime"] = w.EndTime;
                                dates.Add(w.StartTime);
                            }
                        }

                        dtEvents.Rows.Add(dtRow);
                    }
                    // just query the same query again.

                    if (calFeed.NextChunk != null)
                    {
                        oQuery.Uri = new Uri(calFeed.NextChunk);
                        calFeed = oSrv.Query(oQuery) as EventFeed;
                    }
                    else
                        calFeed = null;
                }

                grdEvents.DataSource = dtEvents;
                grdEvents.DataBind();

                DateTime[] aDates = new DateTime[dates.Count];
                int i = 0;
                foreach (DateTime d in dates)
                {
                    aDates[i++] = d;
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }

        }

        #endregion




Tango wrote:
> Hi All,
>
> I have a web application which is accessing all events in a calendar. It is
> working fine locally. I merged this application into Windows Azure Emulator.
> I added web application as "web Role". Then, application while retriving
> event entries is giving an error:
>
> *InnerException    {"A connection attempt failed because the connected party
> did not properly respond after a period of time, or established connection
> failed because connected host has failed to respond 209.85.231.104:443"}
> System.Exception {System.Net.Sockets.SocketException}
> *
> Please help me to resolve this issue. If you need any kind of more
> information from my side, please let me know.

-- 
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://code.google.com/apis/calendar/community/forum.html

Reply via email to