I'm using Nigel B Coates Outlookmail class
There's 500+ lines of code I'm sure you don't want to weed through but here's the form code that crashes:
The point is everything worked until the Office 2000 upgrade
Thanks
This is in the init of the form:
LPARAMETERS lcUserName, ; lcPassword, ; && Password (can be blank)
llUnreadOnly, ; && .T.=only load unread messages &&& doesn't work
lcSenderName, ; && Sender name to filter
lcSubject, ; && Subject to filter
lcMessageFromDate, ; && Message receipt start date to filter
lcMessageToDate && Message receipt end date to filter
SET CLASSLIB TO OutlookMail additive
public m.mailbox, m.whatbox
m.whatbox="Inbox"
*--- Nigel B Coates' Outlookmail.vcx classlib
THISFORM.oMail=CREATEOBJECT("cusMail"
This is in the click event of the button that crashes:
LOCAL moveloc
moveloc=0
Thisform.lastpoll.value=time()
Select mailboxes && table with inbox names
Go top
Scan for !empty(boxname)
* m.mailbox=alltr(mailboxes.boxname)
If ThisForm.Optionlive.value=2 && Users mailbox
* empty(m.mailboxl)
* home
m.mailbox=""
* added ID because all folders are named the same on the server.
m.entryid=""
Else
* m.mailbox=alltr(m.mailboxl)
* work
m.mailbox=alltr(mailboxes.boxname)
m.entryid=alltr(mailboxes.entryid)
Endif
Thisform.oMail.ReadMail("","",.T.,"","","",""
noadded=0
* alltr(mailboxes.boxsubject)
If !isnull(THISFORM.oMail.oInbox)
* I should count backwards in case new mail comes in...
* see move below...
* find "Completed" folder under this mailbox
For y=1 to THISFORM.oMail.oInbox.folders.count
If lower(THISFORM.oMail.oInbox.folders[y].name)="completed"
* set step on
moveloc=THISFORM.oMail.oInbox.folders[y]
Exit
Endif
Endfor
my=THISFORM.oMail.oInbox.Items.Count
For x=1 to my
* just get non read messages!
* nocount=
If !SEEK(THISFORM.oMail.oInbox.Items[(my+1)-x].entryid, "email" , 'ID') ;
and !empty(THISform.oMail.oInbox.Items[(my+1)-x].body) and iif( empty(m.mailbox),.T., inlist(alltr(THISform.oMail.oInbox.Items[(my+1)-x].subject),;
"General Enquiry Contact Request","Renault Expert Contact Request",;
"Renault Brochure Request","Servicing & Warranty Contact Request"

)
Wait window "Adding new record.. "+ alltr(str(x)) nowait
noadded=noadded+1
Insert INTO email (subject, sender, messagetxt,ReceivedTime,timesent,id,new, autoadded);
values( THISform.oMail.oInbox.Items[(my+1)-x].subject ,THISform.oMail.oInbox.Items[(my+1)-x].SenderName, ;
THISform.oMail.oInbox.Items[(my+1)-x].body,THISFORM.oMail.oInbox.Items[(my+1)-x].ReceivedTime,;
THISFORM.oMail.oInbox.Items[(my+1)-x].senton, THISFORM.oMail.oInbox.Items[(my+1)-x].entryid,.T., datetime() )
Thisform.oMail.oInbox.Items[(my+1)-x].unread=.F.
* can't move while reading cause the number of items changes!!!
Thisform.oMail.oInbox.Items[(my+1)-x].move(moveloc)
Endif
Endfor
Endif !isnull
Wait window "Mailbox: "+m.mailbox+" added "+ alltr(str(noadded))+" Records at "+time() nowait
* moving records
If !isnull(THISFORM.oMail.oInbox) && added 12/06/01
mcnt=THISFORM.oMail.oInbox.Items.Count
*Set step on
* find "Completed" folder under this mailbox
For y=1 to THISFORM.oMail.oInbox.folders.count
If lower(THISFORM.oMail.oInbox.folders[y].name)="completed"
moveloc=THISFORM.oMail.oInbox.folders[y]
Exit
Endif
Endfor
For x=1 to mcnt
If THISFORM.oMail.oInbox.Items[(mcnt+1)-x].unread=.F.
* can't move while reading cause the number of items changes!!!
* count backwards
Thisform.oMail.oInbox.Items[(mcnt+1)-x].move(moveloc)
* THISFORM.oMail.oInbox.Items[(mcnt+1)-x].move(THISFORM.oMail.oInbox.folders[1]) && can't guarantee its 1
* THISFORM.oMail.oInbox.Items[(mcnt+1)-x].move("Completed"
Endif
Endfor
Endif !null
Endscan
Thisform.refresh()
Thisform.Command4.click() && process that updates email details
Michael Ouellette
mouellette@tpg.com.au