Quantcast
Channel: SharePoint 2013 - General Discussions and Questions forum
Viewing all articles
Browse latest Browse all 26374

Sharepoint Online - Send email with attachment

$
0
0

Hi All,

is there some way how to send email with attachment, which is attached to list item in host web?

I tried some of solutions but none of them not working.

Server side:

For example event receiver after added list item with attachment - Because it is office 365, in SandBox solution I can´t use SmtpClient class.

Any other ideas?

Client side:

For example client web part with REST call. It works fine until I don´t need access to attachment.

string oDataUrlAttach = "/_api/Web/lists/getbytitle('ListName')/Items(6)/AttachmentFiles('Document.docx')/$value";

            HttpWebRequest itemRequestAttach = (HttpWebRequest)HttpWebRequest.Create(sharepointUrl.ToString() + oDataUrlAttach);

            itemRequest.Method = "GET";
            itemRequest.Accept = "application/atom+xml";
            itemRequest.ContentType = "application/atom+xml;type=entry";
            itemRequest.Headers.Add("Authorization", "Bearer " + accessToken);
            HttpWebResponse itemResponseAttach = (HttpWebResponse)itemRequestAttach.GetResponse();

Here I get error: The remote server returned an error: (403) Forbidden.

But other calls are OK. I can get all items from my list except attachments.

Any ideas?

Thank you.



Viewing all articles
Browse latest Browse all 26374

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>