1

I need to add a column to a document library that will have the text "Send in email" for each document in the library. If a user clicks on it, it should open a new Outlook email and automatically add that document as an attachment. The user can then type in a subject and a receiver and a message and so on, but the important thing is that the document must be added as an attachment to the email.

Is this possible?
And if it is, how could I achieve this with just JavaScript? I figured out how to create the column and add the text "Send in email" to it and I can fetch the path of the document too, and in an anchor I added a Mailto and it works fine (opens a new email) but it doesn't add an attachment. From what I've read this is not possible due to security reasons. Is there an alternative to this, where I can still add the document as an attachment to an email?

On a side note, everyone in our company has Outlook installed on their machine and they all have permissions to access the SharePoint site (it's an intranet site).

If the attachment can't be added, could it perhaps be possible to download the document to a temp directory, then add it to a new email? Or is this also impossible?

I'd really prefer this in JavaScript since I'm not that advanced with C# yet.

0

as you mentioned due the security you can't add attachment in new email. All that you can it is create "mailto:" link with pre-filled fields (to, subject, body), but it also might not work, if client has specific settings or he hasn't outlook.

As workaround I may suggest you have a look at using workflows, the basic scheme may looks as follows: An user click on the link (custom action) and run workflow "Send email". The workflow get current item data, attachment links and send email with attachments.

In my case exist a nuance, out of the box SharePoint workflow doesn't allow you to send email with attachments, but you can extend their functionality using 3rd party solutions, I would recommend you to use Plumsail Workflow Actions Pack, and "Send e-mail with attachments" workflow action for this.

P.S.: I'm one of the developer of this product and know it as very good product for such purposes.

  • I know I could use a workflow but the thing is that the person who sends the email with the document as an attachment has to be able to fill in the body of the email. So the email can't be one that is automatically sent, it has to open in the client email program so that he/she can add some more text and then send the email. All our employees have Outlook installed. – Magali Oct 27 '14 at 7:47
0

After serious investigation I fear there is no such option when limited to JavaScript. An attachment cannot be added directly to an e-mail. An alternative would be to add the URL of the document you want to send to the body of the e-mail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.