Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Outlook and VFP
Message
From
24/04/2024 06:43:39
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01687918
Message ID:
01687933
Views:
33
Hello Sergey,

Thanks for the reply.

Do you know if it's possible to get the inbox for a given account? RIght now I can see the emails
for my office 365 account. I'd like to see the inbox content of another account.

I executed the code that I showed here on a windows sever 2016 machine. I just got a "Finished" from the messagebox. I only had one account on my server and there was unread messages in the inbox.

>6 is Inbox
>See https://learn.microsoft.com/en-us/office/vba/api/outlook.oldefaultfolders
>
>>
>>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é
Previous
Reply
Map
View

Click here to load this message in the networking platform