Some guy at Microsoft developed an add-in for Sharepoint Portal Server Document Libraries, in which a link to a document can be send directly through email... usually a thing we do about a million times a day, although we have to use some annoying copy-paste actions. Why isn't this available as default function, people?
- Locate “ows.js” file controlling the
java script content for SharePoint
pages.
The default location is:
C:\Program Files\Common Files\Microsoft Shared\web server
extensions\60\TEMPLATE\LAYOUTS\1033
- Locate the function AddDocLibMenuItems(m, ctx).
Add the following code at the end of the function:
strDisplayText = "Send link via E-Mail ";
strImagePath = ctx.imagesPath + "iceml.gif";
strServerUrl = ctx.HttpRoot;
intPos1 = strServerUrl.indexOf("://");
intPos2 = strServerUrl.indexOf("/", intPos1 +3);
strServerUrl = (intPos2 == -1 ? strServerUrl :
strServerUrl.substring(0, intPos2));
CAMSep(m);
CAMOpt(m,
strDisplayText , "javascript:SendMail('" + strServerUrl +
currentItemEscapedFileUrl + "')", strImagePath);
- Create a function “SendMail” with the
following code:
function SendMail(currentItemEscapedFileUrl)
{
var mailUrl = "mailto:?subject=Document
reference&Body=<" + currentItemEscapedFileUrl + ">";
document.location = mailUrl;
}
- Save the ows.js file
- Go into a Document Library – and try it. It
should work with other mail clients as well (eg Notes).