Thursday, May 22, 2014

Email with attachment in sharepoint

Share/Save/Bookmark

Today i had to implement a feature, email(using lotus notes) a file as an attachment in SharePoint 2013. I would concentrate here on the approach taken and leave 'how to create ribbon button' for you to google.

If we recall,SharePoint 2010 has the ribbon option, Email a link that allows user to send an email with link to the file/item of document library which even do not exist in SharePoint 2013 for document libraries. SharePoint is doing this by using mailto protocol which i considered as the option to implement my requirement leaving behind the other option that deals with building smtp messages.

msdn documentation says that mailto protocol do not support attach header anymore and so do the other blog posts. But, in my case with lotus notes i'm able to use attach option with mailto protocol to invoke lotus notes and create a new email with file attached that's ready to send. Not sure if this works with latest versions of IE and outlook. Note that mailto invokes the default email client set on the user machine.

Syntax:
mailto:?subject=shared a link&body=message&attach=\\domain.com\sites\dept\filename.docx

Path that is passed to attach attribute recognized by WebDAV to connect to sharepoint site and loads the file.Its pretty similar to how explorer view works in sharepoint. Files in sharepoint can be accessed outside either by using WebDAV or FPRPC.
Ensure to encode the special characters in the above line.

It worked so well and a quick implementation but lately i realized it not working with https sites which has become a roadblock. After so much of play with webdav url pattern i found the solution and have to modify the protocol to,

mailto:?subject=shared a link&body=message&attach=\\domain.com@SSL\sites\dept\filename.docx

That way im able to convey to webdav that the location of the file is on HTTPS site and the authentication is successful. Though it worked on all windows machines its a different story on how to make it work on MAC /apple machines(with finder).


Subscribe

No comments:

Post a Comment