I have an issue where I need to have my web application attach a file from a url (sharepoint url).
My code below will work for a direct file path but I will get an error if I try to do it with a url. The main reason why I need to be able to do this is because I want to create a custom action in sharepoint and have it send a document as an attachment.
below is my code for calling Outlook. Please Note for this to work you must Microsoft.Office.Core and Microsoft.Office.Interop.O
utlook for it to work
Microsoft.Office.Interop.Outlook.ApplicationClass _MsOutlook = new Microsoft.Office.Interop.Outlook.ApplicationClass();
Microsoft.Office.Interop.Outlook.NameSpace oNs = null;
Microsoft.Office.Interop.Outlook.MailItem oMailItem = (Microsoft.Office.Interop.Outlook.MailItem)_MsOutlook.CreateItem(OlItemType.olMailItem);
oMailItem.Subject = "";
oMailItem.To = "";
oMailItem.CC = "";
oMailItem.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatHTML;
oMailItem.HTMLBody = stBody;
oMailItem.Attachments.Add(TextBox1.Text, (int)Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, stBody.Length + 1, stDisplayName);