Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook crashes with Ole error

Status
Not open for further replies.

RoadRunnerOz

Programmer
Aug 22, 2000
128
AU
Outlook error: OLE error code 0x34767483: Unknown COM status code
This is a repeat because my details were a little off on the versions.

A customer has been running a VFP application for years now.

The program reads mail from 3 Outlook mailboxes, moves the mail to a "completed" folder and updates the database.

All was fine until they updated to Office 2002. Now the program gives them the above error after updating one record. They simply restart the program & continue until all mail is read, one at a time.

They are using Win2000, VFP6 Service Pack 5, Exchange and Office 2002 (It was office 2000)
Of course they answer yes when asked if they want to give Outlook control to another program. They select 5 or 10 minutes but it falls over long before that.

Any ideas? I believe it's a security setting MS added but I can't find where?

Thanks in advance..

Michael Ouellette
mouellette@tpg.com.au
 
Jolicoeur

Can you post the portion of code at which point it crashes? It may be that things have changed a little with Outlook and one of your commands requires an extra parameter.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
* get Inbox name
thisform.oInbox=THIS.GetMailObject("MyInboxMailbox")

procedure getmailobject
LPARAMETERS lcRequiredFolder

* Create the necessary objects to get to the message
THIS.oApplication=CREATEOBJECT("Outlook.Application")
THIS.oNameSpace=THIS.oApplication.GetNameSpace("MAPI")
RETURN THIS.GetFolder(lcRequiredFolder)

Procedure getfolder
Lparameters lcRequiredFolder

Local lnFolderNumber, ;
lnLoop, ;
lcFolderName,;
lcFolderNameIn

mexit=.F.

lnFolderNumber=0

For ii=1 to this.oNameSpace.Folders.Count

With THIS.oNameSpace.Folders[ii]
lcFolderName= .name
If LOWER(lcFolderName)=LOWER(lcRequiredFolder)
For lnLoop=1 TO .Folders.Count
lcFolderNameIn=.Folders[lnLoop].Name
If LOWER(lcFolderNameIn)= "inbox"
lnFolderNumber=lnLoop
mexit=.T.
Exit
Endif
Endfor
Endif LOWER(lcFolderName)=LOWER(lcRequiredFolder)

Endwith
if mexit=.T.
exit
endif
Endfor

If lnFolderNumber>0
Return THIS.oNameSpace.Folders[ii].Folders[lnFolderNumber]
Else
Return NULL
Endif

The above all works fine

If !isnull(THISFORM.oMail.oInbox)
* find "Completed" folder under this mailbox
For y=1 to THISFORM.oMail.oInbox.folders.count
If lower(THISFORM.oMail.oInbox.folders[y].name)="completed"
CompletedMailBox=THISFORM.oMail.oInbox.folders[y]
Exit
Endif
Endfor
* so far so good

CountUnreadItems=THISFORM.oMail.oInbox.Items.Count && works
for x=1 to CountUnreadItems
* crashes here on move
THISFORM.oMail.oInbox.Items[(CountUnreadItems+1)-X ].move("CompletedMailBox") && move from oldest to newest in case new mail comes in
endfor
That's it!





Michael Ouellette
mouellette@tpg.com.au
 

Other then the fact that you do not specify the "implicit" path of the destination folder:

myDestFolder = myInbox.Folders("CompletedMailBox")
myItem.Move(myDestFolder)

Your seems correct.



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top