?
Solved

How do I pass values from a web page to a user defined field in an Outlook template?

Posted on 2008-06-22
3
Medium Priority
?
220 Views
Last Modified: 2010-03-30
Dear Experts,

This is a follow-up to question:
http://www.experts-exchange.com/Programming/Languages/Java/Q_23495980.html

I have an Outlook template assigned the value "whatform" in the code below. In addition to setting the To, Subject, and Body, I would like to pass a value from the web page to a user defined field named "pig" in the template.

VB appears to use something like mailItem.UserProperties.pig = "bacon"; but this syntax doesn't work in Java.

Appreciate any help!!

Thanks much,
Ragnar
function OpenOutlookDoc(whatform) 
   { 
      try 
      { 
      outlookApp = new ActiveXObject("Outlook.Application"); 
      nameSpace = outlookApp.getNameSpace("MAPI"); 
      mailFolder = nameSpace.getDefaultFolder(6); 
      mailItem = mailFolder.Items.add(whatform);
      mailItem.To = "Ragnar64@some.net";
      mailItem.Subject = "eMail for you";
      mailItem.Body = "eMail for you.";
 
      mailItem.Display(0)
      } 
      catch(e) 
      { 
      // act on any error that you get 
      } 
   }

Open in new window

0
Comment
Question by:Ragnar64
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 2000 total points
ID: 21841017
Just a guess but try

mailItem.UserProperties['pig'] = "bacon";
0
 

Author Comment

by:Ragnar64
ID: 21841052
Dear CEHJ,

It worked with a slight modification - change [] to () i.e. - mailItem.UserProperties('pig') = "bacon";

Thank you very much - your "guesses" are much better than mine :)

- Ragnar
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 21841446
:-)
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
This article describes how to import Lotus Notes Contacts into Outlook 2016, 2013, 2010 and 2007 etc. with a few manual steps. You can easily export and migrate Lotus Notes contacts into Microsoft Outlook without having to use any third party tools.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month9 days, 20 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question