Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am trying to attach a file to outlook Application using java script.Its working fine in IE 10 and above but not in any other browsers.

Here is my requirement.

  1. For Document Library

    a. When a user comes and click on ECB Menu of a file for a document Library.

    b. I have given a custom ECB action. On click of which I want the document to be attached to outlook appilcation.

  2. For Search

    a. Similar functionality is required when a user comes and click on my custom link in search preview pane.

Below is my full code. On click of my custom link I am calling the below function.

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;
}

I am facing issue in below line of code.

 var objO = new ActiveXObject('Outlook.Application');

The ActiveXObject works only with IE but it does not show any result with any other browser. Below is the link which I used.

http://sharepointmakesmecry.wordpress.com/2012/01/16/attach-document-from-sharepoint-document-library-to-a-new-email-message-in-outlook/

I also searched on Internet and found the ActivexObject only works for IE and not for any other browser.

Please help!!

Any other solution to this will be appreciated.

share|improve this question

1 Answer 1

ActiveX will only work with IE, that is definitive. There are products that mask this (such as Firefox extensions), but they are still using IE to render their pages.

The only way I can see this working is to create custom server side webservice that you can call that will get the item and send the message from the server, but that takes Outlook out of it entirely.

You may want to look at embedding and office "app" into a SharePoint "app" which is now supported in SharePoint 2013. I have no experience with Office apps, their capabilities or their limitations. SharePoint Apps do support custom ECB menu items though, so something to checkout (assuming you are using 2013).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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