Steffen said:
Any idea how I can change an attachment, when a user tries to access it?
What is the actual problem you're trying to solve? Here are a couple
ideas that might help you to get around the current issues, but
knowing the real problem might help someone else to think of a better
approach to a real solution.
What about saving ALL attachments to the file system in
BeforeAttachmentSave or related event? Then you can control access to
who opens the files, and you can control what happens when they open
the file from triggers or application code outside of Outlook. You
may want to remove the attachments from Outlook after they've been
saved. I use a macro to remove attachments, put them into a specific
location based on sender and date, and then the body of the mail is
updated with the location of the related file(s).
Here's software for doing something similar:
<
http://www.sperrysoftware.com/Outlook/Attachment-Save.asp?Source=RS>
Is there a way to stop users from doing a SaveAs in Outlook? If so,
then you can turn off the user ability to save attachments and give
them a custom routine of your own. For the above macro I click a
toolbar button - that's an event you can trap.
About changing an attachment, it depends what the attachment is. If
the user opens a Word document, you can use a Word macro or add-in to
see where the file is coming from, and to take some action. If the
path contains "Temporary Internet Files\OLK" then you know Outlook has
the file open.
You can also change that temp directory and then put a
FileSystemWatcher on it so that you can see what's getting dumped into
it and take action. See this KB article for info:
http://support.microsoft.com/kb/817878
HTH