Problems with outlook.dll

Discussion in 'Bug Reports' started by Gerd, Dec 12, 2007.

  1. Gerd

    Gerd Member Licensed User

    Hi!
    (i hope my english is good enough to understand) ;-)

    Im writing a tool to import/export contacts as vcards and have some trouble while accessing data:

    *************************************
    First problem: Contact.WebPage

    setting Contact.WebPage by program to a nonvalid URL (without leading http://) produced an runtime error - not a real problem: syntaxcheck is possible;-)

    BUT:

    If Contact.Webpage contains an non valid URL (entering or editing the contact manually by user) then accessing to this field produces an runtime error!

    How to access or syntaxcheck this field if every access fails?


    ***********************************************
    Second problem: Contact.Birthday and Contact.Anniversary

    If the user has no date(s) in an contact entry the query

    strDate = Date(Contact.Birthday) delivers the date: 01/01/1601

    in this case the reverse operation:

    Contact.Birthday = ParseDate(strDate)

    generates an runtime error to!

    If birthdday or anniversary set to an actual date -> No problem


    ******************************************************
    my sample code for the second problem (in case its an human problem):
    ******************************************************

    Sub Globals
    'Declare the global variables here.
    End Sub

    Sub App_Start
    ErrorLabel(errHandler)
    Form1.Show
    Contact.New1
    PimCol.New1("Contacts")
    nr = PimCol.FindItem("LastName","Tester")
    If nr > -1 Then
    Contact.Value = PimCol.GetItem(nr)

    ContactDateTicks=Contact.Birthday
    ContactDateString=Date(Contact.Birthday)

    'reverse operation
    ContactDateNewTicks=DateParse(ContactDateString)

    'for showing query results only
    Label1.Text = ContactDateTicks &crlf
    Label1.Text = Label1.Text & ContactDateString &crlf
    Label1.Text = Label1.Text & ContactDateNewTicks &crlf

    'following line now fails if Contact entry is not set to a ?valid? date
    Contact.Birthday = ContactDateNewTicks
    Contact.Update
    Else
    Label1.Text = "Create a contact with Lastname: Tester first!"
    End If
    Label1.Text = Label1.Text & "SUCCESS!"
    Form1.Refresh
    Sleep(3000)
    AppClose

    errHandler:
    Label1.Text = Label1.Text & "FAIL!"
    Form1.Refresh
    Sleep(4000)
    AppClose
    End Sub
     
    Last edited: Dec 12, 2007
  2. Erel

    Erel Administrator Staff Member Licensed User

    1) You will need to use ErrorLabel to handle invalid URL pages.
    2) I don't see this behavior when I run similar code.
    What happens if you do: Msgbox(DateParse("01/01/1601")) ?
     
  3. Gerd

    Gerd Member Licensed User

    Now i know a little bit more...

    I see: 504911232 000000000

    at least two hours i tried some code to create a new or update an existing contact with an birthday entry :

    This date/code really fails:
    Contact.Birthday = DateParse("01/01/1601")

    And this really works:
    Contact.Birthday = DateParse("01/01/1901")

    BUT!!!

    The error accours not at putting the data into Contact.Birthday! The errors occours at:
    Contact.update or PimCol.AddItem(Contact.Value)


    +++++++++++++++++++++++++++++++++++
    Code sample - in any case msgbox() will be showed with the ticks.
    After closing the MsgBox the Message "Fail" will be displayed (or not)
    +++++++++++++++++++++++++++++++++++

    Sub App_Start
    ErrorLabel(errHandler)
    Form1.Show
    Contact.New1
    PimCol.New1("Contacts")
    Contact.CreateNew
    Contact.LastName="Tester"
    ' Contact.Birthday = DateParse("01/01/1901") ' with this line it works
    Contact.Birthday = DateParse("01/01/1601") ' with this line it fails
    Msgbox(Contact.Birthday)

    PimCol.AddItem(Contact.Value)
    Sleep(3000)
    AppClose

    errHandler:
    Label1.Text = "FAIL!"
    Form1.Refresh
    Sleep(4000)
    AppClose
    End Sub


    +++++++++++++++
     
  4. agraham

    agraham Expert Licensed User

    According to Microsoft Embedded developer Centre Pocket Outlook model
    Could it be because "01/01/1601" is out of range?
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    I think that agraham is right (as usual) about the valid range of dates.
     
  6. Gerd

    Gerd Member Licensed User

    I agree!

    Manualy entering a date less then 1900 will be automatically corrected!

    Now i know that something goes wrong inside outlook.dll/Win Mobile 6/my Smartphone, that it is generating an non valid date while reading an empty entry ...

    So I have wrote a small hack around...

    Thanks to all and i wish you a happy new year!

    Gerd
     
Loading...