locked
I Need Help on my application!.. RRS feed

  • Question

  • Hello everyone..I'm developing on a window mobile application that link to the pocket outlook calendar..i need help on how i can retrieve some free days which i dont have any appointment and display it in a multiline textbox..

    Friday, March 14, 2008 3:24 AM

Answers

  • Hi eDdie_sPore,

    You can use POOM to get all appointments , then exclude these appointments time, you can get free days.

    Code Snippet

    using (OutlookSession session = new OutlookSession())

    {

    AppointmentCollection ac = session.Appointments.Items;

    foreach(Appointment a in ac)

    {

    //a.Start+a.End

    }

     

    }

     

     

    Best regards,

    Guang-Ming Bian - MSFT

    Tuesday, March 18, 2008 2:40 AM
  • Hi

    a.Start is the StartDate and a.End the EndDate of the appointment. You have to loop through all your appointments.
    The days where no appointment starts (a.Start) or ends (a.End) are your free days.


    Greetings,
    Stefan
    Tuesday, March 18, 2008 12:11 PM

All replies

  • Hi eDdie_sPore,

    You can use POOM to get all appointments , then exclude these appointments time, you can get free days.

    Code Snippet

    using (OutlookSession session = new OutlookSession())

    {

    AppointmentCollection ac = session.Appointments.Items;

    foreach(Appointment a in ac)

    {

    //a.Start+a.End

    }

     

    }

     

     

    Best regards,

    Guang-Ming Bian - MSFT

    Tuesday, March 18, 2008 2:40 AM
  • thanks Guang_Ming Bian for your help..but i dun understand wat's a.Start+a.End..can u explain abit more..thanks..

    Tuesday, March 18, 2008 3:40 AM
  • Hi

    a.Start is the StartDate and a.End the EndDate of the appointment. You have to loop through all your appointments.
    The days where no appointment starts (a.Start) or ends (a.End) are your free days.


    Greetings,
    Stefan
    Tuesday, March 18, 2008 12:11 PM
  • thanks stefan..but can u show a sample of it..in more detail?..because i do not really know how to loop..thanks..

    Tuesday, March 18, 2008 12:16 PM
  • Here's a small VB function

     
    Code Snippet

    Private Function isFreeDay(ByVal dDate As Date) As Boolean
        Dim session As Microsoft.WindowsMobile.PocketOutlook.OutlookSession = New OutlookSession()
        Dim ac As AppointmentCollection = session.Appointments.Items
        For Each a As Appointment In ac
          If Date.Compare(dDate, a.Start) Or Date.Compare(dDate, a.End) Then
            Return False
          End If
        Next
        Return True

      End Function



    Tuesday, March 18, 2008 1:05 PM
  • hi..really thank you stefan..but im using C# to develop my application..i tried to convert the code into C# language..but there's an error in the code..hope u can solve my problem..thanks..

    Wednesday, March 19, 2008 6:08 AM
  • hi stefan..im using this code to do..

     

    using (OutlookSession session = new OutlookSession())

    {

    foreach (Appointment appt in session.Appointments.Items)

    {

    // Display the subject of each appointment

    // within the listbox

    listBox1.Items.Add(appt.Subject);

    }

    }

     

    can you help me to modify this code so tat i can display the free days in my calendar..thanks..

    Wednesday, March 19, 2008 7:58 AM
  • Hi,

    sorry, I can not write a complete program for you. I don' t understand what you mean with 'display the free days in my calendar'. You can see the free days in your calendar. This are the days without an appointment. Perhaps you can give some more details about this.

    Hope that helps,
    Stefan
    Wednesday, March 19, 2008 8:27 PM
  • Hi,

     

    Thanks for the trouble for helping me. My meaning of displaying the free days in my calendar means, without looking at the calendar, using my mobile application, I can detect the free days automatically when i press a button. Those free days will then display on a listbox.

     

    Hope that will help,

    Eddie

    Wednesday, March 19, 2008 8:32 PM
  • Hi Eddie,

    As we discussed , you can enumerate all appointments, then calculate each appointment start time and end time. The time out of all appointments time range is free time.

     

    Best regards,

    Guang-Ming Bian - MSFT

     

     

    Thursday, March 20, 2008 3:17 AM
  • Hi Guang-Ming Bian,

    I have tried to enumerate all the appointments too..but i didn't know how to calculate the time..can you give me a sample code on C#. Thanks for giving me some much informations. Really appreciate everyone help.

    Thursday, March 20, 2008 3:25 AM