I’m afraid I can’t take the credit for this one – my colleague Jagan came up with this neat solution to allow a user to attach a document from a SharePoint document library straight to a new Outlook email message. Don’t ask me why MS don’t include this OOB – I get asked about it so often…
The Problem
The problem with using a document library to store documents is that it can be tricky to get a document out and email it outside of the organisation. It’s not always practical to setup extranet sites etc etc – sometimes you just need to email a document out.
Usually, you’d have to download the document from the library to your desktop, then start a new email, then attach the document.
[A] Solution
This solution is not *perfect*, and it will not work in all scenarios – but it will work in most.
You just need to create a feature with a CustomAction block, shown below:
<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <CustomAction Id="AttachToEmail.ItemToolbar" RegistrationId="101" RegistrationType="List" Location="EditControlBlock" Sequence="900" Title="Email Document" ImageUrl="/_layouts/images/EmailPST.png"> <UrlAction Url="javascript:function launchOutlook(itemUrl){ var docUrl = location.protocol + '//' + location.host + itemUrl; var objO = new ActiveXObject('Outlook.Application'); var objNS = objO.GetNameSpace('MAPI'); var mItm = objO.CreateItem(0); mItm.Display(); mItm.Attachments.Add(docUrl); mItm.GetInspector.WindowState = 2; }launchOutlook('{ItemUrl}');"/> </CustomAction> </Elements>
When you activate the feature, you should see an extra menu option in
your Edit Control Block (ECB) dropdown on each document in your library:
This will use the Outlook ActiveX control to stream the document to a new
email message:
Some Caveats
As I said – there may be some limitations with this approach:
1. Only one document can be added to each email (in this version – it would be possible to modify the above to cater for a selection of documents)
2. Since it’s ActiveX – cross browser support is v.sketchy – IE only really
3. It’ll work best in standard internal ‘intranet’ environments, where the authentication is integrated
… but, that’s it. Give it a go in your projects and let me know how it turns out.
If you’d like me to wrap it into a WSP for download leave a comment…
.davros.
Perfect,I will let you know if it works. And also, is there any update on multiple attachments.
I was able to import and activate it but when I click the “Email Document”, it does not do anything. Any ideas? Thanks!!
Hi,
can i plesae have this as a WSP?
Thanks
Matt
Hi,
I’ve try that on my Sharepoint Online, but when I click on “Email Document”..doest do nothing..
Any ideas?
Thank you,
Vittorio
To attach a Sharepoint library file to an Outlook message, right click/Copy link on the Sharepoint library document, then paste this link after having clicked “Attach file” in a new Outlook message, simple…
I would like a WSP as well, Thanks!