views:

152

answers:

0

How do i programmatically change the filename of an Outlook item attachment. Ideally I'd like it to be something like this:

Outlook.DocumentItem d;
foreach (object ob in oFolder.Items) {
  d=(Outlook.DocumentItem)ob;
  d.Attachments[1].FileName = "xyz.pdf";
}

Please ignore assumption about there being an attachment, Im only interested in the method to assign a new name to the attachment... but unfortunately the FileName property is readonly.

So my work around is to add another attachment with the name I desire and delete this the original. But is there a simpler/cleaner way?