Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Outlook and VFP
Message
From
21/04/2024 16:40:51
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Outlook and VFP
Miscellaneous
Thread ID:
01687918
Message ID:
01687918
Views:
48
Hello all,

I'd like to process emails that I have in Outlook.

So far I dit this to test
LOCAL oOutlook, oNamespace, oFolder, oMailItem
oOutlook = CREATEOBJECT("Outlook.Application")
oNamespace = oOutlook.GetNameSpace("MAPI")
oFolder = oNamespace.GetDefaultFolder(6)  && 6 for the reception box.
FOR EACH oMailItem IN oFolder.Items

    If oMailItem.unRead 
	    ? oMailItem.Subject
	    ? SUBSTR( oMailItem.Body, 1, 500)
	    ? oMailItem.SenderName
	    ? oMailItem.ReceivedTime
        oMailItem.unRead = .F. && Mark it as read
    Endif
ENDFOR
MESSAGEBOX("Finished")
This works. I thought it would give me emails in my default
folder but no, it gives all email in my Office365 folder.

In outlook I changed the default folder, but still it's the emails that are in
the office 365 folder that gets processed.

IF I change to this
oFolder = oNamespace.GetDefaultFolder(1)
I receive a bunch or effors

IF I change to this
oFolder = oNamespace.GetDefaultFolder(2)
I receive a bunch or effors

IF I change to this
oFolder = oNamespace.GetDefaultFolder(3)
It works a little bit but I also receive a bunch or effors

What is the meaning of the parameters in GetDefaultFolder()?

? SUBSTR( oMailItem.Body, 1, 500)
I thought that I would receive only the content of the Body. but this
gives me a lot more than I wanted. That's why I went for only a substring
to see what's in there. Why so much informations? Any way to get only the
content of the received email?

I'd prefer to process emails that are in another folder. Not the office365
folder. How can I specify in which folder I want to process the emails?

All help apreciated.

Is there a white paper or a class that could help me using Outlook in VFP?


Regards
*******************************************************
Save a tree, eat a beaver.
Denis Chassé
Next
Reply
Map
View

Click here to load this message in the networking platform