Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7646749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:17:15+00:00 2026-05-31T10:17:15+00:00

I am creating an appointment in Outlook through java code. here I can set

  • 0

I am creating an appointment in Outlook through java code. here I can set new values to the fields in appointment. The code for it is

OleAutomation appointment = invoke(outlook, "CreateItem", 1).getAutomation();
appointment.setProperty(property(appointment, "Subject"), new Variant("Test"));

this code will set the subject field with the value “Test”.

here i am using generic OLE mechanism “Variant” for passing data of different types via a common interface
Now I want to know how to set a date for the appointment. Please help me..

Thanks in advance 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T10:17:17+00:00Added an answer on May 31, 2026 at 10:17 am

    As stated in my comment, the date in OLE are stored as the number of days since 1899-12-30.
    You can calculate that number easily. When you have it, pass-it to to the right OLE property using standard variant I think.

    Unfortunately I don’t have SWT installed here and can’t test the code, but it should look something like that

    public class Test {
        static Calendar OLE_BASE_DATE = Calendar.getInstance();
        static {
            OLE_BASE_DATE.set(1899, 11, 30); // 1899-12-30
        }
    
        static double oleDateFormat(Calendar cal) {
            long diff = cal.getTimeInMillis() - OLE_BASE_DATE.getTimeInMillis();
            return diff / 86400000L;
        }
    
        public static void main(String[] args) {
            // get outlook instance etc...
            OleAutomation appointment = invoke(outlook, "CreateItem", 1).getAutomation();
            appointment.setProperty(property(appointment, "Subject"), new Variant("Test"));
            // compute the appointment start & stop
            double todayAtNoon = oleDateFormat(Calendar.getInstance()) + 0.5;
            double todayAt13_12 = oleDateFormat(Calendar.getInstance()) + 0.55;
            // set the vars
            appointment.setProperty(property(appointment, "Start"), new Variant(String.valueOf(todayAtNoon)));
            appointment.setProperty(property(appointment, "End"), new Variant(String.valueOf(todayAt13_12)));
            appointment.setProperty(property(appointment, "Location"), new Variant("At foo's"));
            // do more stuff
        }
    }
    

    More info on the automation of Outlook can be found here for a complete example in VB

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating an Outlook 2003 version of a Outlook 2007 add-in for appointment
I need to change the owner of an appointment record when creating a new
I am creating an Outlook Add-in that creates new appointments, like so: Outlook.AppointmentItem oAppointment
Creating a batch script in Windows XP. Here's a snippet of code I'm having
I'm having some difficulties creating a javascript appointment style calendar. While it does render,
I have a small problem. I am creating an appointment table where in the
I'm creating outlook appointments using webdav. I'm using following post body to create the
I am creating a calendar application. I have a Appointment table, and a Person
Creating the closure is easy but using it is confusing for me. Here is
I am creating an Outlook 2007 add-in that adds a form region to an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.