Adding an attachment to default email client from client side - javascript

I tried to create a new mail with an attachment using mailto. It is opening a new mail window in Outlook 2010 but without attachment. While investigating the issue I understood that it is impossible to achieve using mailto. Is there any other way to achieve it? I researched about it but I couldn't find anything useful.

In Java Script?
If you are running inside IE from a trusted site, you can create an instance of the Outlook.Application COM object and use OOM to create a message with attachments.
You can programmatically build an EML (MIME) file that includes HTML body and attachments and let user download that file. Outlook will be happy to open an EML and display it to an end user.

Related

How to open outlook client on machine from browser to add calendar event?

I am trying to open outlook client from a website (i.e. from browser)
I can find a way to open outlook client if I want to mail someone like so:
Click here to mail
Currently, I download .ics file on client machine and user can manually add an event to their default mail client by clicking on .ics file.
is there a way to directly open outlook client and add calendar event without having user to click on the .ics file?
Thanks for help in advance.
You cannot execute shell commands on the client-side, like executing an application. That is a security hole and browsers will never let that happen.

How to connect to outlook from browser (internet explorer)

So this is what I need for my customer
From my secure intranet webapplication the user can select several files. Somehow (browser plugin/add-on, JavaScript, whatever) the user can start outlook to compose a new mail. The selected files have to be attached to the composed mail. To make things even more interesting, the filenames of the attached files have to be altered (the file version has to be added to the filename).
It must work with Outlook 2013 and Internet Explorer 11.
I don't want the mail to be created in the browser and then be send from the server, since I want the user to have full control on the composed mail and have them use all the features of Outlook.
What would be the right technique(s) to accomplish this?
Dynamically create an EML file (MIME) and give the user a link to it. Outlook will be able to open the message with the HTM body, recipients, attachments, etc. prepopulated.
Try to use this into your javascript
mailto:email#domain.com?subject=file&body=P.F.A&attachment='filepath/filename.extention'

Save email to outlook folder using ActiveXObject or Office Javascript API?

In outlook, there is a feature “Home page address” of folder through which we can view web site within the outlook. If we set http://app.abctest.com in the Home page address of a folder, then when we click this folder in the outlook, it will display that page.
I have a very specific requirement for enabling end user to browse a web site (in my case, it basically lists some archived emails) within from the Outlook. This can be easily done by setting the “Home page address” in the properties windows of any Folder of Outlook.
The user will see the page within outlook. He can search the old archived emails in the page. Then, the users should be able to download that email and save it to a folder in outlook. End users are basically searching the emails within outlook and downloading them from the server directly to their outlook folder. When user click the download\save link or button, then the outlook’s “Select Folder” dialog should appear where user can select the destination folder. When user click “OK” button, that email should be save to the selected folder in the outlook.
Currently, I have very few solutions but not sure if they can achieve the goal.
Solution 1: ActiveXObject
I tried to use Outlook ActiveXObject in javascript (used the following code in my test page) but I got the following Script error Popup message.
“Automation server cannot create the object”.
Javascript code:
var objO = new ActiveXObject('Outlook.Application');
Solution 2: Javascript API for Office
I have started to read the MSDN documentation https://msdn.microsoft.com/en-us/library/office/fp142185.aspx but have not got any sample code.
Could someone please sheds some light on it? Or what would be the best solution for this? Or any alternative solution.
Prakash,
Only one instance of Outlook can be run at the same time. Try to use the GetObject function instead to get the running Outlook instance instead. See How to programmatically create an Outlook home folder page in the Outlook Today style for more information. However, home page scripting is limited and secured to prevent malicious software. I'd suggest developing an add-in which can add a custom form instead.
The second solution listed above is for Mail Apps. See How to: Create your first mail app for Outlook by using Visual Studio for more information.
When your script runs inside a folder home page, window.external.OutlookApplication will point to an instance off the Outlook.Application object - your should be able to use it without creating a new object.

open Camera Roll from Java Script method in iOS

I have requirement to load one JSP/HTML5 page in UIWebView. In this page there is link for attachment and on click of that I need to open CameraRoll to select file and then upload it to server. This is same like we do attachment in email. Now problem is from Java Script how do I open CameraRoll? My main query is that is it possible to open CameraRoll from Java Script without calling Native iOS methods. Java Script to open dialog is embedded in JSP/HTML5 page.
Let me know if you find that above information is not enough so I will try to give you more detail. Ultimately I have one page in UIWebView which should work like sending some message to user with attachment from CameraRoll like we do in normal email app.
I searched a lot on net but couldnt find any help on this.
Starting in iOS6, you can access the Media Capture API which allows you to request files from the user via <input type="file" />.
Essentially, all you need to do is include an <input type="file" /> and when the user touches the input, it will open the phone's camera roll.
Once the user has selected the file, you can send the file using the POST form action or AJAX, or use the File API to manipulate the file data on the client side. Check out the HTML Media Capture specification from the W3C for more information on implemention.

how to open csv file in IE in by javascript

In my asp page, I have to open a csv file in IE by java script. The code which I am using is as below:
csvWindow = window.open("/com/csv/"+csvFileName, "datacsv", "toolbar=yes,location=no,directories=yes,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=790,height=450,screenX=50,screenY=25,left=50,top=25");
Code is running in IIS server.
When I run this code and open csv file it gives below message
Microsoft Office Excel cannot access the file
"http://192.168.3.228:107/com/csv/CSV_file_1345728.csv". There are several possible reasons:
The file name or path does not exist
the file is being used by another program
the workbook you are trying yo save has the same name as a currently open workbook.
But file is being created.So path is correct and i think that file is also not used by another program
Please help me what should I do
The problem is that when Excel is opened it will attempt to fetch the CSV file itself, this a change in behaviour in office apps since 2007. However since Excel runs in a different process it will not send any cookies that would have been generated during the logon. When the website receives the request it will respond with a 401 status.
There are no easy solutions that I know of with entirely satisfactory results. Here are a number of solutions but all have drawbacks.
Make the authentication cookie persistent, this will allow Offices apps to pick up and send the cookie. The down side being the user remains persistently logged even after a client machine reboot (much like how Stackoverflow appears to work).
Use a standard HTTP authentication protocol like "Basic" or "Negotiate". The down side is that this will cause Excel to display a logon box and the user has to logon again. One exception to this drawback is using "Negotiate" or "NTLM" against an IIS box where the site is registered as part of the IE's Intranet Zone, in which case the HTTP stack used by excel will attempt to use the current user credentials.
Have a server side script that can run anonymously send the csv file and include in the URL some unique ID (such as GUID) which is a one off grant of access. Much more complex to set up.
If you want to open the file with MS Excel, you could try not to serve the file directly, but write an ASP page with Content-Type=application/force-download, the real file name ending with .css and the actual file content. In this case, MSIE will first download the file to the local disk cache and then will feed it to MS Excel.
If you just want to show the CSV text in the browser window, maybe the best is to change its extension or to make some proxy page with Content-Type=text/plain and no mention of CSV at all. The association CSV/Excel seems to be hardcoded in MSIE.

Categories

Resources