Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Open text attachment from Groupwise and import it

Posted on 2004-04-05
15
Medium Priority
?
309 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 2000 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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…

916 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