Solved

Open text attachment from Groupwise and import it

Posted on 2004-04-05
15
293 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
Comment Utility
0
 
LVL 34

Author Comment

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

Expert Comment

by:nico5038
Comment Utility
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
 
LVL 34

Author Comment

by:flavo
Comment Utility
Getting there...
0
 
LVL 34

Author Comment

by:flavo
Comment Utility
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
Comment Utility
Looks OK to me, did you try to reinstall Office and/or apply the ServiceReleases ?

Nic;o)
0
 
LVL 34

Author Comment

by:flavo
Comment Utility
>> 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 34

Author Comment

by:flavo
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Works!
0
 
LVL 54

Expert Comment

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

Nic;o)
0
 
LVL 34

Author Comment

by:flavo
Comment Utility
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

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

762 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

9 Experts available now in Live!

Get 1:1 Help Now