Can I replace the attachment file when double chick attachment?

S

swzhengst

I want to replace the attachment when double chick the attachment. I
use outlook form to do it.
Beause attachment read in outlook is not a cancelable event, I can't do
it directly.

I found outlook always store attachments file in directory:
"%USERPROFILE%\Local Settings\Temporary Internet Files\OLK*".
So if I want to replace the attachment when user double chick the
attachment, I can repalce the attachment file(will display) in that
directory.

I have some test, outlook allow me do that. But I meet two question:
First: the directory is different with each user, I always start with
the work I type before and end with a random value. How can I get the
exactly value of it in vbscript?

Second. When user chick the attachment, outlook will download the
attachment and save to the directory with the name: attachment
filename(number). If I have a attachment name "aaa.txt", it maybe save
with "aaa(10).txt". Can I get the exactly name of it?
 
L

Lanwench [MVP - Exchange]

In
I want to replace the attachment when double chick the attachment. I
use outlook form to do it.
Beause attachment read in outlook is not a cancelable event, I can't
do it directly.

I found outlook always store attachments file in directory:
"%USERPROFILE%\Local Settings\Temporary Internet Files\OLK*".
So if I want to replace the attachment when user double chick the
attachment, I can repalce the attachment file(will display) in that
directory.

I have some test, outlook allow me do that. But I meet two question:
First: the directory is different with each user, I always start with
the work I type before and end with a random value. How can I get the
exactly value of it in vbscript?

Second. When user chick the attachment, outlook will download the
attachment and save to the directory with the name: attachment
filename(number). If I have a attachment name "aaa.txt", it maybe save
with "aaa(10).txt". Can I get the exactly name of it?

Hi - unfortunately, I'm not sure I understand what it is you're trying to
do. You can't really control what happens to your mail once the user
receives it. Can you not just instruct the users to save the attachment
rather than merely opening it?
 
S

swzhengst

What I want to do is: when user double click a attachment, chick open
in the Open, Save, Cancel dialog. normally it will display the
attachment file.
Now what I want to do is replace the file, display another file to
user.

So I do some code in Item_AttachmentRead() in outlook form, but the
AttachmentRead isn't a cancelable event. what ever I code in this
function, outlook will display the original attachment file after all.

But I found another way to do that: when the user double click a
attachment, click open, then outlook will download the attachment into
a Temporary directory, it's path is: "%USERPROFILE%\Local
Settings\Temporary Internet Files\OLK*", with filename: attachment
filename(number). then outlook will run the Item_AttachmentRead()
method, after that display the attachment file. So I think I can write
some code into Item_AttachmentRead() to replace the downloaded
Temporary attachments file in the Temporary directory.

So if I can get the "%USERPROFILE%\Local Settings\Temporary Internet
Files\OLK*" and the attachment filename(number), I can replace the
attachment to display.

My question is how can the get the exactly value of
"%USERPROFILE%\Local Settings\Temporary Internet Files\OLK*" and
attachment filename(number).

I have another question: If use double chick a attachment, then chick
save button in Open, Save, Cancel dialog, then save the attachment to a
disk, I can do nothing in this steps. I found BeforeAttachmentSave is
not work here. Is there any way I can do the purpose like
before(replace the attachment)? OR can I prevent user chick the
attachment(double chick and right chick)?

My outlook is outlook 2003. The code I want to write in is outlook
form.
 
L

Lanwench [MVP - Exchange]

In
What I want to do is: when user double click a attachment, chick open
in the Open, Save, Cancel dialog. normally it will display the
attachment file.
Now what I want to do is replace the file, display another file to
user.

So I do some code in Item_AttachmentRead() in outlook form, but the
AttachmentRead isn't a cancelable event. what ever I code in this
function, outlook will display the original attachment file after all.

But I found another way to do that: when the user double click a
attachment, click open, then outlook will download the attachment into
a Temporary directory, it's path is: "%USERPROFILE%\Local
Settings\Temporary Internet Files\OLK*", with filename: attachment
filename(number). then outlook will run the Item_AttachmentRead()
method, after that display the attachment file. So I think I can write
some code into Item_AttachmentRead() to replace the downloaded
Temporary attachments file in the Temporary directory.

So if I can get the "%USERPROFILE%\Local Settings\Temporary Internet
Files\OLK*" and the attachment filename(number), I can replace the
attachment to display.

My question is how can the get the exactly value of
"%USERPROFILE%\Local Settings\Temporary Internet Files\OLK*" and
attachment filename(number).

I have another question: If use double chick a attachment, then chick
save button in Open, Save, Cancel dialog, then save the attachment to
a disk, I can do nothing in this steps. I found BeforeAttachmentSave
is not work here. Is there any way I can do the purpose like
before(replace the attachment)? OR can I prevent user chick the
attachment(double chick and right chick)?

You can't do that as far as I know. (and I think you mean click, not chick
! ) You should probably post this in an Outlook developer's group for more
help, I think.
 

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