Saving Attachments - Redemption

N

news.microsoft.com

Hi,
I'm sandboxing with Redemption to see if it will do my task. So far I can
send emails with attachments, no problem - Outlook 2K.

The code below is retrieving replies, saving the Attachments to strPath and
deleting the message - except the saveasfile fails. I also tried
SafeItem.Attachments.Save, same error 438 property not supported.

Read a lot of the Google threads but don't see alternative to Save or
SaveAsFile. Can someone point me in the right direction?

Code:
Dim SafeItem As Object
Dim objOutlook As Object
Dim oNamespace As Object
Dim Utils As Redemption.MAPIUtils
Dim oOutlookItems As Object
Dim oOutlookItem As Object
Dim arrSubject As Variant
Dim strUserFilename As String
Dim strPath As String
'
' SET UP OUTLOOK
Set objOutlook = CreateObject("Outlook.Application")
Set oNamespace = objOutlook.GetNamespace("MAPI")
oNamespace.Logon
' SET UP REDEMPTION
Set SafeItem = CreateObject("Redemption.SafeMailItem") 'Create an
instance of RedemptionSafeMailItem
Set Utils = CreateObject("Redemption.MAPIUtils") 'Create an
instance of Redemption.MAPIUtils
' GET INBOX CONTENTS
Set oOutlookItems =
objOutlook.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items
' LOOK AT EACH ITEM IN THE INBOX
For Each oOutlookItem In oOutlookItems
'test for items in the subject line (PWAttach & ProjID), then assign
the item to SafeItem
If InStr(1, oOutlookItem.Subject, "PWAttach", vbTextCompare) <> 0
Then
'test for ProjID
arrSubject = Split(oOutlookItem.Subject, ",")
For i = 0 To UBound(arrSubject)
If arrSubject(i) = "PWAttach" Then
If arrSubject(i + 1) = gOptions.ActiveProjectID Then
'this is one of our replies
strUserFilename = arrSubject(i + 2)
SafeItem.Item = oOutlookItem
'get the UF path
strPath = GetUFPath(strUserFilename)
'overwrite the file
SafeItem.Attachments.SaveAsFile strPath
'delete the message
SafeItem.Item.Delete
End If
End If
Next
End If
Next
'clean up happens later...

Thanks for any help,
Jim Spicer
 
K

Ken Slovak - [MVP - Outlook]

SafeItem.Attachments.SaveAsFile strPath

There is no SaveAsFile method for the Attachments collection. That
method must be called on an individual Attachment in that collection.
Does this work?

SafeItem.Attachments.Item(1).SaveAsFile strPath
 
J

Jim Spicer

Yes, Ken Thank you. Another set of experienced eyes is invaluable.

Now I guess I'll try to do something besides plow through the entire Inbox.

thanks again,
Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top