Is it possible to drop over FWH window email msgs

Is it possible to drop over FWH window email msgs

Postby AHF » Fri Dec 12, 2008 8:54 am

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

Antonio
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby James Bott » Fri Dec 12, 2008 2:17 pm

Antonio,

You can try something like this:

Code: Select all  Expand view
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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby AHF » Fri Dec 12, 2008 3:49 pm

James,

Thanks

Antonio
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby Otto » Fri Dec 12, 2008 6: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
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby AHF » Fri Dec 12, 2008 8: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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby Otto » Fri Dec 12, 2008 9: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

Image
Image

Code: Select all  Expand view
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




Code: Select all  Expand view
#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
//----------------------------------------------------------------------------//


User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby AHF » 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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby driessen » 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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Postby Otto » Sat Dec 13, 2008 7:43 am

Michel,
you can change the macro that also the attachments are saved.

Regards,
Otto

Code: Select all  Expand view

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


User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby AHF » Sat Dec 13, 2008 2: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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby Otto » Mon Dec 15, 2008 1: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
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby James Bott » Mon Dec 15, 2008 2: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Otto » Mon Dec 15, 2008 2: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

Code: Select all  Expand view
   

#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




   
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby James Bott » Mon Dec 15, 2008 2: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby James Bott » Mon Dec 15, 2008 3:01 pm

Otto,

This link may contain an answer to your questions.

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

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 98 guests