开发者

Add Outlook attachment by reference to Sharepoint document

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜