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
204 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
Sometimes Outlook might have problems sending a message. There may be various causes- corrupted PST, AV scanner etc. The message, instead of going to the Sent Items folder, sits in the Outbox indefinitely. To remove it you can use a free tool cal…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

947 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now