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
213 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 500 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
The viewer will learn how to implement Singleton Design Pattern in Java.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

740 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