Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Saving outlook text files
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01546194
Message ID:
01546440
Views:
38
>>>>>>>>>How can I save outlook messages as text files
>>>>>>>>
>>>>>>>>Use Automation and the SaveAs method of the MailItem object.
>>>>>>>>
>>>>>>>>Tamar
>>>>>>>
>>>>>>>Thanks for that but I am afraid i don't understand what you are getting at
>>>>>>>
>>>>>>>What is Automation in this context and what is the Mailitem object?
>>>>>>>
>>>>>>>Can you please give me an example in use
>>>>>>
>>>>>>You can automate Outlook, like this:
>>>>>>
>>>>>>
>>>>>>LOCAL oOutlook, oNS, oInbox, oItem
>>>>>>oOutlook = createobject('Outlook.Application')
>>>>>>oNS = oOutlook.GetNameSpace('MAPI')
>>>>>>
>>>>>>oInbox = oNS.GetDefaultFolder[6]  && 6 is the main Inbox folder
>>>>>>
>>>>>>* Assuming you want the last item
>>>>>>oItem = oInbox.Items[oInbox.Items.Count]
>>>>>>
>>>>>>* assumes you already set up name of output file in cFileWithPath
>>>>>>oItem.SaveAs(cFileWithPath, 0) && 0 is txt type
>>>>>>
>>>>>>
>>>>>>MailItem is the name of the class in Outlook used for individual emails.
>>>>>>
>>>>>>Tamar
>>>>>
>>>>>Tamar - thanks
>>>>>
>>>>>My code
>>>>>
>>>>>cFileWithPath="m:\outlook\dax"
>>>>>
>>>>>LOCAL oOutlook, oNS, oInbox, oItem
>>>>>oOutlook = createobject('Outlook.Application')
>>>>>oNS = oOutlook.GetNameSpace('MAPI')
>>>>>
>>>>>oInbox = oNS.GetDefaultFolder[6] && 6 is the main Inbox folder
>>>>>
>>>>>* Assuming you want the last item
>>>>>oItem = oInbox.Items[oInbox.Items.Count]
>>>>>
>>>>>* assumes you already set up name of output file in cFileWithPath
>>>>>oItem.SaveAs(cFileWithPath, 0) && 0 is txt type
>>>>>
>>>>>This comes up with an error on the last line Parameter no Optional
>>>>>
>>>>
>>>>Make sure to include the filename you want in cFileWithPath.
>>>>
>>>>Tamar
>>>
>>>I did include the file name - this is my code
>>>
>>>cFileWithPath="m:\outlook\dax"
>>>
>>>LOCAL oOutlook, oNS, oInbox, oItem
>>>oOutlook = createobject('Outlook.Application')
>>>oNS = oOutlook.GetNameSpace('MAPI')
>>>
>>>oInbox = oNS.GetDefaultFolder[6] && 6 is the main Inbox folder
>>>
>>>* Assuming you want the last item
>>>oItem = oInbox.Items[oInbox.Items.Count]
>>>
>>>* assumes you already set up name of output file in cFileWithPath
>>>oItem.SaveAs(cFileWithPath, 0) && 0 is txt type
>>>
>>>This comes up with an error on the last line Parameter no Optiona
>>
>>Hmm. Just tested and I see this, too. I tried a couple of variations involving accessing the item more directly (rather than saving it to a local variable) and they didn't work either.
>>
>>Not sure what to suggest.
>>
>>Tamar

Thanks for your help so far - let me know if you crack it
Specialist in Advertising, Marketing, especially Direct Marketing

I run courses in Business Management and Marketing
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform