Is it possible to drop over a FWH window email messages draging it directly from Outlook ou Outlook express ?
Antonio
Antonio H Ferreira
Is it possible to drop over a FWH window email messages draging it directly from Outlook ou Outlook express ?
Antonio
ACTIVATE DIALOG oDlg ON INIT DropFiles( oDlg )
FUNCTION DropFiles( oDlg )
DragAcceptFiles( oDlg:hWnd, .T. )
oDlg:bDropFiles := { | nRow, nCol, aFiles | MSgInfo( aFiles[1] ) }
RETURN (.T.)James,
Thanks
Antonio
AHF,
have you tried the solution James suggested? Does it work for you.
Could you please post a working example.
I never was able to get the content from Outlook or Outlook express directly.
I have written a VB6 program which extracts the content from Outlook express
and with Outlook I use a macro.
The macro saves the email into a folder and then I have a FWH program with a timer
which looks if a msg is there and then I import the content to my DMS system.
The new Windows mail does save all the msg into single files. Here it is easy to get the content.
Regards,
Otto
My collegue that was testing it informed that was working, but now I'm trying it and it doesn't. I will check next monday on his PC
Antonio


Sub SaveEmail()
Dim myItems, myItem As Object
Dim myOrt As String
Dim myOlApp As New Outlook.Application
Dim myOlExp As Outlook.Explorer
Dim myOlSel As Outlook.Selection
myOrt = "c:\whoLIMP\"
On Error Resume Next
'work on selected items
Set myOlExp = myOlApp.ActiveExplorer
Set myOlSel = myOlExp.Selection
'for all items do...
For Each myItem In myOlSel
myItem.SaveAs myOrt & "xxxx.txt", olTXT
myItem.SaveAs myOrt & myItem.EntryID & ".txt", olTXT
myItem.SaveAs myOrt & myItem.EntryID & ".msg", olMSG
'myItem.Delete
Next
'free variables
Set myItems = Nothing
Set myItem = Nothing
Set myOlApp = Nothing
Set myOlExp = Nothing
Set myOlSel = Nothing
End Sub#include "fivewin.ch"
function main()
local oWnd, oTmr
DEFINE WINDOW oWnd TITLE "Dokumentenmanagement - elektronische Archivierung" ;
FROM 0.4,0.8 TO 8,30 ;
SETWINDOWPOS( oWnd:hWnd, -1, 0, 0, 0, 0, 3 )
DEFINE TIMER oTmr INTERVAL 2000 ACTION OutlookEmail( oTmr,oWnd ) OF oWnd
ACTIVATE TIMER oTmr
ACTIVATE WINDOW oWnd
return nil
function OutlookEmail( oTmr,oWnd )
local cDir := ""
local aDirServ := {}
local IDirServ := 0
local cDatei := ""
local cAufruf := "Outlook"
local cEmaildmsdbf := ""
local cNotiz := ""
local Emaildmsdbf := ""
*--------------------------------------------------------------------------
oTmr:Deactivate()
cDir := "c:\whOlImp"
if lIsDir(cDir) = .F.
lMKDir(cDir)
endif
cDir := cDir + "\"
aDirServ := directory(cDir + "*.msg", "D")
FOR IDirServ := 1 TO len(aDirServ)
cDatei := cdir + aDirServ[IDirServ,1]
cEmaildmsdbf := MemoRead("c:\whOlImp\xxxx.txt")
Emaildmsdbf := substr(cEmaildmsdbf,AT("Betreff:",cEmaildmsdbf))
cNotiz := left(ALLTRIM(substr(cEmaildmsdbf,10)),1000)
msginfo( Emaildmsdbf + CRLF+CRLF+cNotiz )
ferase(cDatei)
oWnd:END()
next
oTmr:Activate()
return nil
//----------------------------------------------------------------------------//I think that with Outlook you can do it directly through activex.
But unfortunatly isn't possible with OE express (my problem).
Wouldn't be also possible to extract data through ODBC connection to Outlook database?
Antonio
Otto,
Your solution looks very interesting for me.
I'll try it out in one of the coming days.
But what do you do with the attachments ?
Thanks.
Regards,
Michel D.
Genk (Belgium)
I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773
Sub SaveEmail()
Dim myItems, myItem As Object
Dim myOrt As String
Dim myOlApp As New Outlook.Application
Dim myOlExp As Outlook.Explorer
Dim myOlSel As Outlook.Selection
Dim anhang As Outlook.Attachment
myOrt = "c:\whoLIMP\"
On Error Resume Next
'work on selected items
Set myOlExp = myOlApp.ActiveExplorer
Set myOlSel = myOlExp.Selection
'for all items do...
For Each myItem In myOlSel
myItem.SaveAs myOrt & "xxxx.txt", olTXT
myItem.SaveAs myOrt & myItem.EntryID & ".txt", olTXT
myItem.SaveAs myOrt & myItem.EntryID & ".msg", olMSG
For Each anhang In myItem.Attachments
anhang.SaveAsFile myOrt & mail & "_" & anhang.FileName
'MsgBox (anhang.DisplayName)
Next
'myItem.Delete
Next
'free variables
Set myItems = Nothing
Set myItem = Nothing
Set myOlApp = Nothing
Set myOlExp = Nothing
Set myOlSel = Nothing
End SubOtto,
Your solution seems very simple and effective unfortunatly I cannot use it because I realt need to move the email files to FWH app as it's done in Outlook.
These files can be dragged to the explorer and even to other applications.
Shoudln't FWH provide the means to do it ? Is it a bug?
Antonio
Today I found an interesting post:
Drag and Drop
Supporting drag and drop from Outlook into VFP can be surprisingly easy.
OLE Drag and Drop from Outlook only supports a text object, and that object can't give you
enough information to actually uniquely identify the item (or items) that are dragged
from Outlook. The text will depend on the order of columns in the user's Outlook view,
but is usually tab-separated text of "From","Subject","Date" and separate lines of
tab-separated text for each message.
The trick is to ignore the dragged object altogether, and query Outlook directly.
An entire example is included on the conference CD (DropMail.*), but the key is
to use the ActiveExplorer property.
Explorers and Inspectors in Outlook are the equivalent of Explorer interfaces and
forms in VFP.
You can access these to determine what information is displayed to the user
and react appropriately.
In the case of drag-and-dropping, the files most recently selected by the user to
initiate the action are selected in the currently active Explorer.
All that is needed to retrieve a handle to those objects is the following code snippet:
loOutlook = CREATEOBJECT("Outlook.Application")
loSelection = loOutlook.ActiveExplorer.Selection
Regards,
Otto
Hi Otto,
>All that is needed to retrieve a handle to those objects is the following code snippet:
Any idea how we can use this to retrieve the actual text of the message? I assume it would be in RTF?
Regards,
James
#define olFolderInbox 6
//----------------------------------------------------------------//
function Main()
LOCAL oOutlook := CREATEOBJECT( "Outlook.Application" )
LOCAL oNameSpace := oOutlook:GetNameSpace("MAPI")
LOCAL oInbox := oNameSpace:GetDefaultFolder( olFolderInbox )
LOCAL i , oItems
LOCAL ioMail
local myItem
// ?local oItems1 := createOleObject( "oOutlook.ActiveExplorer.Selection" )
// ?local oInbox := oOutlook.CurrentFolder("get" )
// ?local myOlExp := createOleObject( "oOutlook.ActiveExplorer" )
msginfo( oInbox:name() )
msginfo( oNameSpace:GetDefaultFolder(6):Folders:Count)
For i = 1 TO oNameSpace:GetDefaultFolder(6):Folders:Count
msginfo(oNameSpace:GetDefaultFolder(6):Folders[ i ]:name)
msginfo(oNameSpace:GetDefaultFolder(6):Folders[ i ]:Items:Count)
For ioMail = 1 to oNameSpace:GetDefaultFolder(6):Folders[ i ]:Items:Count
myItem := oNameSpace:GetDefaultFolder(6):Folders[ i ]:Items[ ioMail ]
// msginfo( myItem:SenderName)
// msginfo( oNameSpace:GetDefaultFolder(6):Folders[ i ]:Items[ ioMail ]:Subject)
// msginfo( oNameSpace:GetDefaultFolder(6):Folders[ i ]:Items[ ioMail ]:To)
// msginfo( oNameSpace:GetDefaultFolder(6):Folders[ i ]:Items[ ioMail ]:Body)
// msginfo (myItem:EntryID & ".msg")
myItem:SaveAs ( "c:\temp\" + ALLTRIM(str(ioMail)) + "demo.msg" )
Next
Next
oOutlook:Quit()
RETURN NILHere is some information about the various formats and the differences between Outlook and Outlook Express.
http://forums.devx.com/showthread.php?t=36739
Regards,
James
Otto,
This link may contain an answer to your questions.
http://www.aksel.com/whitepapers/dragdrop.htm
Regards,
James