FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Is it possible to drop over FWH window email msgs
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Is it possible to drop over FWH window email msgs
Posted: Fri Dec 12, 2008 08:54 AM

Is it possible to drop over a FWH window email messages draging it directly from Outlook ou Outlook express ?

Antonio

Regards

Antonio H Ferreira
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Is it possible to drop over FWH window email msgs
Posted: Fri Dec 12, 2008 02:17 PM
Antonio,

You can try something like this:

ACTIVATE DIALOG oDlg ON INIT DropFiles( oDlg )

FUNCTION DropFiles( oDlg )

   DragAcceptFiles( oDlg:hWnd, .T. )
   oDlg:bDropFiles := { | nRow, nCol, aFiles | MSgInfo( aFiles[1] ) }

RETURN (.T.)


Regards,
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Is it possible to drop over FWH window email msgs
Posted: Fri Dec 12, 2008 03:49 PM

James,

Thanks

Antonio

Regards

Antonio H Ferreira
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Is it possible to drop over FWH window email msgs
Posted: Fri Dec 12, 2008 06:42 PM

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

Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Is it possible to drop over FWH window email msgs
Posted: Fri Dec 12, 2008 08:53 PM

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

Regards

Antonio H Ferreira
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Is it possible to drop over FWH window email msgs
Posted: Fri Dec 12, 2008 09:24 PM
Hello AHF,

Here is a little FW program and the wordmacro I use. For the wordmacro I insert a button on the buttonbar of Outlook.

Maybe someone of you have a better solution.

Regards,
Otto




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
//----------------------------------------------------------------------------//
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Is it possible to drop over FWH window email msgs
Posted: Fri Dec 12, 2008 10:33 PM

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

Regards

Antonio H Ferreira
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Is it possible to drop over FWH window email msgs
Posted: Sat Dec 13, 2008 12:53 AM

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

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Is it possible to drop over FWH window email msgs
Posted: Sat Dec 13, 2008 07:43 AM
Michel,
you can change the macro that also the attachments are saved.

Regards,
Otto

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 Sub
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Is it possible to drop over FWH window email msgs
Posted: Sat Dec 13, 2008 02:13 PM

Otto,

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

Regards

Antonio H Ferreira
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Is it possible to drop over FWH window email msgs
Posted: Mon Dec 15, 2008 01:08 PM

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

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Is it possible to drop over FWH window email msgs
Posted: Mon Dec 15, 2008 02:43 PM

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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Is it possible to drop over FWH window email msgs
Posted: Mon Dec 15, 2008 02:45 PM
To all,

I did some more tests but I still have for a working drag & drop solution from Outlook two problems to resolve:

1)
DragAcceptFiles( oDlg:hWnd, .T. )
Does not react to Outlook files.

Can someone help to transform this VB6 code which is working to FWH.

Private Sub Form_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Data.GetFormat(vbCFText) = True Then
MsgBox ("test")
End If
End Sub

2)

I don’t find a way how to dertermine the selected email
(loOutlook.ActiveExplorer.Selection for me is not working.)


Regards,
Otto

   

#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 NIL
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Is it possible to drop over FWH window email msgs
Posted: Mon Dec 15, 2008 02:55 PM

Here 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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Is it possible to drop over FWH window email msgs
Posted: Mon Dec 15, 2008 03:01 PM

Otto,

This link may contain an answer to your questions.

http://www.aksel.com/whitepapers/dragdrop.htm

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10