开发者

Add Outlook attachment by reference to Sharepoint document

开发者 https://www.devze.com 2023-03-17 12:58 出处:网络
I am trying to add a reference to a document located in a sharepoint library as an attachment to Outlook email. I got the following error:

I am trying to add a reference to a document located in a sharepoint library as an attachment to Outlook email. I got the following error:

File name or directory name is not valid.

I used this code:

String sSource = "http://lu3:333/TestList/Doc.txt ";
String sDisplayName = att.DisplayName;
int iPosition = (int)mail.Body.Length + 1;
int iAttachType = (int)Microsoft.Office.Interop.Outlook.OlAttachmentType.olByReference;
mail.Attachments.Add(sSource, iAttachType, iPosition, sDisplayName);

When i use the OlAttachmentType.olByValue it works but by reference it is not.

Anyone have an idea how to fix this? Or is there a better solution to add a refe开发者_如何转开发rence to a document located in sharepoint site as an attachment?

Thank you for your time.


I think you would be better off formatting an html message and link to the file using either an a tag or an image link.

There may be reasons to send an actual attachment, but I would argue against them strongly if possible.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号