Solved

Open text attachment from Groupwise and import it

Posted on 2004-04-05
15
295 Views
Last Modified: 2007-12-19
Having a bit of trouble with this..

What i want to do:

1. Search a Folder in Groupwise and Open all emails with attachment
2. Import it
3. Delete email


Ive searched all of EE and couldn't really find anything, had a look at the documentation on the Novell site and that didnt really help...  Looked at the Object Browser and i got lost...

If i can get to find the emails that are in there, i should be able to get the rest out...

Anyone done this / know where to look???

Dave
0
Comment
Question by:flavo
  • 9
  • 6
15 Comments
 
LVL 54

Accepted Solution

by:
nico5038 earned 500 total points
ID: 10761177
0
 
LVL 34

Author Comment

by:flavo
ID: 10761247
There was a better link for the Novell site in there..  Better than what i could find!
0
 
LVL 54

Expert Comment

by:nico5038
ID: 10761321
I know it's a hard to do this and regrettably I have no groupwise nor experience with it to help you further, but hope this triggers some new insights !

Success !

Nic;o)
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 34

Author Comment

by:flavo
ID: 10762414
Getting there...
0
 
LVL 34

Author Comment

by:flavo
ID: 10762557
its working, but it dies all the time (Excel and Access crash..)

Any ideas???

heres the code - just prints it so far....
Sub PrintAttachments()

Dim oApp As Object
Dim oAcct As Object
Dim oFolders As Object
Dim oFolder As Object
Dim Cnt As Integer
Dim oMessages As Object
Dim oMessage As Message
Dim oAttach As Attachment


Set oApp = CreateObject("NovellGroupWareSession")
Set oAcct = oApp.Login("", "")
If oAcct.Remote = True Then
   'Text1.Text = "Remote"
Else
    'Text1.Text = "Connected"
End If


Debug.Print oAcct.RootFolder.Name
Set oFolders = oAcct.AllFolders
Cnt = 0
For Each oFolder In oFolders
    If oFolder.Name = "BLISSPrint" Then
     Debug.Print oFolder.Name
        Set oMessages = oFolder.Messages
        For Each oMessage In oMessages
       
        Debug.Print oMessage.Subject
           For Each oAttach In oMessage.Attachments
              Debug.Print oAttach.FileName
           Next
        Next
   
 
    End If
Next


Set oApp = Nothing
Set oAcct = Nothing
Set oFolders = Nothing
Set oFolder = Nothing
Set oMessages = Nothing
Set oMessage = Nothing
Set oAttach = Nothing


End Sub
0
 
LVL 54

Expert Comment

by:nico5038
ID: 10767151
Looks OK to me, did you try to reinstall Office and/or apply the ServiceReleases ?

Nic;o)
0
 
LVL 34

Author Comment

by:flavo
ID: 10769639
>> reinstall Office and/or apply the ServiceReleases

Good luck getting the IT guys to do that for me..

It works on my PC, not slower ones... Tested on 4 works on 3 sometimes 2.. Id like it to be a little more stable..
0
 
LVL 34

Author Comment

by:flavo
ID: 10769682
this is what im playing with now....

Sub PrintAttachments1()

Dim oApp As Object
Dim oAcct As Object
Dim oFolders As Folders
Dim oFolder As Folder
Dim oMessages As Messages
Dim oMessage As Message
Dim oAttach As Attachment
Dim i As Integer

Set oApp = CreateObject("NovellGroupWareSession")
Set oAcct = oApp.Login("", "")

i = 0

Set oFolders = oAcct.Cabinet.AllFolders

'loop over folders until we get the BLISSPrint area
For Each oFolder In oFolders
    If oFolder.Name = "BLISSPrint" Then
        Set oMessages = oFolder.Messages
        'loop over all the msg's in there
        For Each oMessage In oMessages
          'if its got an attachment (from Subject) then we want the file
          If oMessage.Subject = "BLISS ATTACHMENT" Then
             'loop over the attachments to get the ones we want
             For Each oAttach In oMessage.Attachments
              If oAttach.FileName = "bliss.csv" Then
                'save them in a temp area so we can import them to Excel / Access later - delete them
                oAttach.Save "C:\Documents and Settings\" & UserName & "\BLISS" & i & ".txt"
                'open
                Workbooks.OpenText FileName:="C:\Documents and Settings\" & UserName & "\BLISS" & i & ".txt", _
                Origin:=xlWindows, StartRow:=1, DataType:=xlFixedWidth, FieldInfo:= _
                Array(Array(0, 9), Array(1, 1), Array(18, 1), Array(26, 1), Array(33, 1), Array(40, 1), _
                Array(47, 1), Array(54, 1), Array(61, 1), Array(68, 1), Array(77, 1))
                DoEvents
               
                i = i + 1
             End If
             'oMessage.Delete
             Next
           
          End If
         
        Next
       
     End If
Next

'clean up
Set oApp = Nothing
Set oAcct = Nothing
Set oFolders = Nothing
Set oFolder = Nothing
Set oMessages = Nothing
Set oMessage = Nothing
Set oAttach = Nothing

End Sub

0
 
LVL 54

Expert Comment

by:nico5038
ID: 10769742
Is this indeed more stable ?
I see you've added the DoEvents and that does indeed sometimes solve some nasty ones !

Nic;o)
0
 
LVL 34

Author Comment

by:flavo
ID: 10769797
I was playing around with them, jamming them in, adding pauses, trying anything!!

I cut down on the number of folders to fly through, that maybe helped...

Just tested on the machine i was having probs with yesterday, and it seemed to work, as long as there aren't too many files in there..

Think it may be getting stuck on saving / opening to many things at once...  Opening it in Excel helped some how... So maybe thats what it was???

I ment to take to code home and compile it to an exe in VB 6, hoping it may be more stable then Excel or Access, but forgot :-(..
0
 
LVL 54

Expert Comment

by:nico5038
ID: 10769883
The pauses between saving/opening might indeed help, perhaps you could add a pause loop based on the file size.

Nic;o)
0
 
LVL 34

Author Comment

by:flavo
ID: 10769909
They're always 5k...

Just tested un commenting the oAttach.Delete and it seemed to work for 26 files, just going to test 30+ and see what happens (should only be about 10 anyway..)

Yep!  Worked for 40 files at a time... Ill do a test on the old laptop and see how we go..

Fingers crossed...
0
 
LVL 34

Author Comment

by:flavo
ID: 10769930
Works!
0
 
LVL 54

Expert Comment

by:nico5038
ID: 10770040
What about storing it first in an Access table to speed up the process ?

Nic;o)
0
 
LVL 34

Author Comment

by:flavo
ID: 10770084
Its fast, takes about 5secs to do 40 files... Good enough for me :-)

Its going to be used in Excel anyway, no one else can use Access..
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now