PC Review


Reply
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average.

Delete attachment

 
 
JoBless
Guest
Posts: n/a
 
      13th Aug 2003
Hi.

I'm playing arround with Micro-eye's vb6 'Outlook COM Add-in Template'

I've added an event to the 'objMailItem_AttachmentAdd', which deletes the
attachment (my intention is to manipulate the file and add the manipulated
file, before deleting the original attachment)

The deletion works fine when I choose the 'Insert'->'File' button to attach
the file (through the 'Insert File' dialog).
When I drag'n'drop the file to the mail-body, it deletes the file, but
outlook returns the error 'Operation failed'.

What can I do to avoid this error, when using drag'n'drop?

Regards

JoBless


 
Reply With Quote
 
 
 
 
JoBless
Guest
Posts: n/a
 
      15th Aug 2003
Is it a MS bug, or?

Is it possible to determine if the attachment was added using drag'n'drop,
or by browsing to it?

If so, I'm willing to disable my vb routine for the drag'n'drop added files.

Regards

JoBless

"JoBless" <(E-Mail Removed)> skrev i en meddelelse
news:(E-Mail Removed)...
> Hi.
>
> I'm playing arround with Micro-eye's vb6 'Outlook COM Add-in Template'
>
> I've added an event to the 'objMailItem_AttachmentAdd', which deletes the
> attachment (my intention is to manipulate the file and add the manipulated
> file, before deleting the original attachment)
>
> The deletion works fine when I choose the 'Insert'->'File' button to

attach
> the file (through the 'Insert File' dialog).
> When I drag'n'drop the file to the mail-body, it deletes the file, but
> outlook returns the error 'Operation failed'.
>
> What can I do to avoid this error, when using drag'n'drop?
>
> Regards
>
> JoBless
>
>



 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      15th Aug 2003
You can't detect if drag and drop is used, and Outlook code doesn't
play that well with drag and drop. Just use an error handler and
handle the error or use On Error Resume Next and clear the error if it
occurs. That way your users won't see any error messages for your
code.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm


"JoBless" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Is it a MS bug, or?
>
> Is it possible to determine if the attachment was added using

drag'n'drop,
> or by browsing to it?
>
> If so, I'm willing to disable my vb routine for the drag'n'drop

added files.
>
> Regards
>
> JoBless
>
> "JoBless" <(E-Mail Removed)> skrev i en meddelelse
> news:(E-Mail Removed)...
> > Hi.
> >
> > I'm playing arround with Micro-eye's vb6 'Outlook COM Add-in

Template'
> >
> > I've added an event to the 'objMailItem_AttachmentAdd', which

deletes the
> > attachment (my intention is to manipulate the file and add the

manipulated
> > file, before deleting the original attachment)
> >
> > The deletion works fine when I choose the 'Insert'->'File' button

to
> attach
> > the file (through the 'Insert File' dialog).
> > When I drag'n'drop the file to the mail-body, it deletes the file,

but
> > outlook returns the error 'Operation failed'.
> >
> > What can I do to avoid this error, when using drag'n'drop?
> >
> > Regards
> >
> > JoBless
> >
> >

>
>



 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      18th Aug 2003
Are you sure the error is being generated by Outlook and not from an
unhandled error in your code? Show some of your code so I can try to
repro the error message here. Also post your Outlook and Windows
versions so I can repro your environment.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm

"JoBless" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I've tried the 'on error resume next' without success, but it seems

that the
> error isn't generated in my add-in, but when my add-in finishes it's

job?!?


 
Reply With Quote
 
JoBless
Guest
Posts: n/a
 
      18th Aug 2003
The easiest way to reproduce the error is, if you download the sample code
form :
http://www.microeye.com/resources/Ou...OM%20Addin.zip

And enable the:Set objMailItem = objItem in ColInsp-NewInspector. Then add
the objMailItem_AttachmentAdd event, and simply add attachment.delete to
this event.

Then you can browse the file and attach it, without problems, but not
drag'n'drop it.

OS: WinXP Pro DK
Office XP XP developer

Btw. Now I'm having trouble deleting the attachment at all, in office 2K
pro, but not in office XP ?!?

Regards

Kim Andersen

"Ken Slovak - [MVP - Outlook]" <(E-Mail Removed)> skrev i en meddelelse
news:%(E-Mail Removed)...
> Are you sure the error is being generated by Outlook and not from an
> unhandled error in your code? Show some of your code so I can try to
> repro the error message here. Also post your Outlook and Windows
> versions so I can repro your environment.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Lead Author, Professional Outlook 2000 Programming, Wrox Press
> Lead Author, Beginning VB 6 Application Development, Wrox Press
> Attachment Options
> http://www.slovaktech.com/attachmentoptions.htm
> Extended Reminders
> http://www.slovaktech.com/extendedreminders.htm
>
> "JoBless" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I've tried the 'on error resume next' without success, but it seems

> that the
> > error isn't generated in my add-in, but when my add-in finishes it's

> job?!?
>
>



 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      19th Aug 2003
I've run ItemsCB many times and never had a problem. Post the code you
are using and I can test it. What is WinXP Pro DK? Is that a German
language version of Windows? That I won't be able to repro.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm


"JoBless" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> The easiest way to reproduce the error is, if you download the

sample code
> form :
> http://www.microeye.com/resources/Ou...OM%20Addin.zip
>
> And enable the:Set objMailItem = objItem in ColInsp-NewInspector.

Then add
> the objMailItem_AttachmentAdd event, and simply add

attachment.delete to
> this event.
>
> Then you can browse the file and attach it, without problems, but

not
> drag'n'drop it.
>
> OS: WinXP Pro DK
> Office XP XP developer
>
> Btw. Now I'm having trouble deleting the attachment at all, in

office 2K
> pro, but not in office XP ?!?
>
> Regards
>
> Kim Andersen



 
Reply With Quote
 
Martynas Kunigelis
Guest
Posts: n/a
 
      19th Aug 2003
DK is Denmark.

"Ken Slovak - [MVP - Outlook]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...

> ... What is WinXP Pro DK? Is that a German
> language version of Windows? That I won't be able to repro.
>


 
Reply With Quote
 
JoBless
Guest
Posts: n/a
 
      20th Aug 2003
DK is Denmark, Europe

I'm not using the ItemsCB, but the com add-in template.

Here is some of my code:

Private Sub objMailItem_AttachmentAdd(ByVal Attachment As
Outlook.Attachment)
Dim FSO As Scripting.FileSystemObject, strInputFile As String, strOutputFile
As String
Dim TempFolder As String

strInputFile = Attachment.FileName
strInputFile = "(temp)" & strInputFile

'Find tempfolder
Set FSO = CreateObject("Scripting.filesystemobject")
TempFolder = FSO.GetSpecialFolder(2)
If Right(TempFolder, 1) <> "\" Then TempFolder = TempFolder & "\"

'vis besked
Message.Label1.Caption = "Konverterer"
Message.Show
Message.Refresh

'Gem filen temporert
If FSO.FileExists(TempFolder & strInputFile) Then FSO.DeleteFile (TempFolder
& strInputFile)
Attachment.SaveAsFile TempFolder & strInputFile

.........................................

Manuipulate the attached file

.........................................

'vent yderligere 2 sec.
Call Sleep(2000)

'Omdžb (fjern (temp) fra destinationsfilen)
FSO.CopyFile TempFolder & strOutputFile, TempFolder & Right(strOutputFile,
Len(strOutputFile) - 6), True
FSO.DeleteFile TempFolder & strOutputFile, True
strOutputFile = Right(strOutputFile, Len(strOutputFile) - 6)

'Tilfžj ny attachment (konverteret)
objMailItem.Attachments.Add TempFolder & strOutputFile, , , strOutputFile

'Slet temporer fil
FSO.DeleteFile TempFolder & strOutputFile, True

'Slet attachment
Attachment.Delete

'clean-up
Set FSO = Nothing

'Skjul message
Unload Message


End Sub


Regarding the outlook2000 issue, i've discovered that the file is deleted as
supposed, it just seems that it isn't deleted. Is it possible to refresh the
outlook form (or anything else), so the file allso is removed visualy ??

Regards

JoBless


"Martynas Kunigelis" <(E-Mail Removed)> skrev i en meddelelse
news:(E-Mail Removed)...
> DK is Denmark.
>
> "Ken Slovak - [MVP - Outlook]" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>
> > ... What is WinXP Pro DK? Is that a German
> > language version of Windows? That I won't be able to repro.
> >

>



 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      21st Aug 2003
I'd always start out using ItemsCB as my template, it has a lot of
stuff that works around various Outlook bugs and problems that we've
discovered over the years. And it also shows the best practices ways
to do Outlook things.

So the problem comes down to the attachment is really being deleted
but visually doesn't show that? Outlook caches open items. I'd release
the open item and get a new copy of it, that should force a refresh of
what's shown.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm


"JoBless" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> DK is Denmark, Europe
>
> I'm not using the ItemsCB, but the com add-in template.
>
> Here is some of my code:
>
> Private Sub objMailItem_AttachmentAdd(ByVal Attachment As
> Outlook.Attachment)
> Dim FSO As Scripting.FileSystemObject, strInputFile As String,

strOutputFile
> As String
> Dim TempFolder As String
>
> strInputFile = Attachment.FileName
> strInputFile = "(temp)" & strInputFile
>
> 'Find tempfolder
> Set FSO = CreateObject("Scripting.filesystemobject")
> TempFolder = FSO.GetSpecialFolder(2)
> If Right(TempFolder, 1) <> "\" Then TempFolder = TempFolder & "\"
>
> 'vis besked
> Message.Label1.Caption = "Konverterer"
> Message.Show
> Message.Refresh
>
> 'Gem filen temporert
> If FSO.FileExists(TempFolder & strInputFile) Then FSO.DeleteFile

(TempFolder
> & strInputFile)
> Attachment.SaveAsFile TempFolder & strInputFile
>
> ........................................
>
> Manuipulate the attached file
>
> ........................................
>
> 'vent yderligere 2 sec.
> Call Sleep(2000)
>
> 'Omdžb (fjern (temp) fra destinationsfilen)
> FSO.CopyFile TempFolder & strOutputFile, TempFolder &

Right(strOutputFile,
> Len(strOutputFile) - 6), True
> FSO.DeleteFile TempFolder & strOutputFile, True
> strOutputFile = Right(strOutputFile, Len(strOutputFile) - 6)
>
> 'Tilfžj ny attachment (konverteret)
> objMailItem.Attachments.Add TempFolder & strOutputFile, , ,

strOutputFile
>
> 'Slet temporer fil
> FSO.DeleteFile TempFolder & strOutputFile, True
>
> 'Slet attachment
> Attachment.Delete
>
> 'clean-up
> Set FSO = Nothing
>
> 'Skjul message
> Unload Message
>
>
> End Sub
>
>
> Regarding the outlook2000 issue, i've discovered that the file is

deleted as
> supposed, it just seems that it isn't deleted. Is it possible to

refresh the
> outlook form (or anything else), so the file allso is removed

visualy ??
>
> Regards
>
> JoBless



 
Reply With Quote
 
JoBless
Guest
Posts: n/a
 
      8th Sep 2003
As it seems to me, the ItemsCB is designed for another purpose, and doesn't
seem easy to edit for my purpose.

The only purpose for me is, to get the event of attachment add, and get the
mailitem, so I can manipulate it.

Is there any other version af ItemCB Ž, that would be esier to use as
template?

Regards

JoBless

"Ken Slovak - [MVP - Outlook]" <(E-Mail Removed)> skrev i en meddelelse
news:e7WLe4%(E-Mail Removed)...
> I'd always start out using ItemsCB as my template, it has a lot of
> stuff that works around various Outlook bugs and problems that we've
> discovered over the years. And it also shows the best practices ways
> to do Outlook things.
>
> So the problem comes down to the attachment is really being deleted
> but visually doesn't show that? Outlook caches open items. I'd release
> the open item and get a new copy of it, that should force a refresh of
> what's shown.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Lead Author, Professional Outlook 2000 Programming, Wrox Press
> Lead Author, Beginning VB 6 Application Development, Wrox Press
> Attachment Options
> http://www.slovaktech.com/attachmentoptions.htm
> Extended Reminders
> http://www.slovaktech.com/extendedreminders.htm
>
>
> "JoBless" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > DK is Denmark, Europe
> >
> > I'm not using the ItemsCB, but the com add-in template.
> >
> > Here is some of my code:
> >
> > Private Sub objMailItem_AttachmentAdd(ByVal Attachment As
> > Outlook.Attachment)
> > Dim FSO As Scripting.FileSystemObject, strInputFile As String,

> strOutputFile
> > As String
> > Dim TempFolder As String
> >
> > strInputFile = Attachment.FileName
> > strInputFile = "(temp)" & strInputFile
> >
> > 'Find tempfolder
> > Set FSO = CreateObject("Scripting.filesystemobject")
> > TempFolder = FSO.GetSpecialFolder(2)
> > If Right(TempFolder, 1) <> "\" Then TempFolder = TempFolder & "\"
> >
> > 'vis besked
> > Message.Label1.Caption = "Konverterer"
> > Message.Show
> > Message.Refresh
> >
> > 'Gem filen temporert
> > If FSO.FileExists(TempFolder & strInputFile) Then FSO.DeleteFile

> (TempFolder
> > & strInputFile)
> > Attachment.SaveAsFile TempFolder & strInputFile
> >
> > ........................................
> >
> > Manuipulate the attached file
> >
> > ........................................
> >
> > 'vent yderligere 2 sec.
> > Call Sleep(2000)
> >
> > 'Omdžb (fjern (temp) fra destinationsfilen)
> > FSO.CopyFile TempFolder & strOutputFile, TempFolder &

> Right(strOutputFile,
> > Len(strOutputFile) - 6), True
> > FSO.DeleteFile TempFolder & strOutputFile, True
> > strOutputFile = Right(strOutputFile, Len(strOutputFile) - 6)
> >
> > 'Tilfžj ny attachment (konverteret)
> > objMailItem.Attachments.Add TempFolder & strOutputFile, , ,

> strOutputFile
> >
> > 'Slet temporer fil
> > FSO.DeleteFile TempFolder & strOutputFile, True
> >
> > 'Slet attachment
> > Attachment.Delete
> >
> > 'clean-up
> > Set FSO = Nothing
> >
> > 'Skjul message
> > Unload Message
> >
> >
> > End Sub
> >
> >
> > Regarding the outlook2000 issue, i've discovered that the file is

> deleted as
> > supposed, it just seems that it isn't deleted. Is it possible to

> refresh the
> > outlook form (or anything else), so the file allso is removed

> visualy ??
> >
> > Regards
> >
> > JoBless

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
When you delete an email in Outlook, is the attachment also delete Sinclair Microsoft Outlook Discussion 3 24th Feb 2009 08:53 PM
can not delete big attachment huseyin Microsoft Outlook 2 17th Apr 2008 02:40 PM
Can't delete Attachment =?Utf-8?B?cGhvY3VzZWQ=?= Microsoft Outlook Discussion 6 13th Oct 2007 05:40 AM
OE6 Attachment Delete persian ram Windows XP Help 2 9th Jul 2007 05:05 PM
Attachment delete method =?Utf-8?B?Q2F0YWxpbg==?= Microsoft Outlook VBA Programming 4 26th Sep 2005 02:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:57 PM.