473,413 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Sending MS Outlook Meeting Request

4
Hi all,

Can someone please send me a working JAVA code that would send a Meeting Request to MS Outlook ?

I Badly need this ASAP ...

My id: mailvidi@gmail.com

Thank You,
Vidi
Sep 28 '06 #1
4 12467
vidi
4
Hi all,

Can someone please send me a working JAVA code that would send a Meeting Request to MS Outlook ?

I Badly need this ASAP ...

My id: mailvidi@gmail.com

Thank You,
Vidi

Hi People ... finally my friend & i have found the solution ourselves !!! If you want the code, lemme know ...
K.R.Vidya Shankar
Oct 3 '06 #2
Hi People ... finally my friend & i have found the solution ourselves !!! If you want the code, lemme know ...
K.R.Vidya Shankar

Can you please post the code? I've been looking for this solution for sometime. Thanks!
Jan 26 '07 #3
Ok People, here's it.. Lemme know if that works..

public void send(String uniqueId, Date reviewDateTime) throws Exception
{
String from = "123@456.com";
String to = "456@456.com";
String meetingStartTime = getReviewTime(reviewDateTime, false);
String meetingEndTime = getReviewTime(reviewDateTime, true);
Properties prop = new Properties();
StringBuffer sb = new StringBuffer();
StringBuffer buffer = null;
Session session = Session.getDefaultInstance(prop, null);
Message message = new MimeMessage(session);

try {
prop.put("mail.smtp.host", "192.168.112.111");
prop.put("mail.smtp.port", "25");

// Define message
message.setFrom(new InternetAddress(from));
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to, false));
message.setRecipients(Message.RecipientType.CC, InternetAddress.parse("123@456.com,456@456.com,789 @456.com"));
message.setSubject("This is the subject of the Meeting Request");
message.setHeader("X-Mailer", "iQuest-Mailer");

// Create the message part
MimeBodyPart messageBodyPart = new MimeBodyPart();
buffer = sb.append("BEGIN:VCALENDAR\n"
+ "PRODID:-//Microsoft Corporation//Outlook9.0 MIMEDIR//EN\n"
+ "VERSION:2.0\n"
+ "METHOD:REQUEST\n"
+ "BEGIN:VEVENT\n"
+ "ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:123@456.com\n"
+ "ORGANIZER:MAILTO:456@456.com\n"
+ "DTSTART:" + meetingStartTime + "\n"
+ "DTEND:" + meetingEndTime + "\n"
+ "LOCATION:Conference room\n"
+ "TRANSP:OPAQUE\n"
+ "SEQUENCE:0\n"
+ "UID:" + uniqueId + "@456.com\n"
+ "DTSTAMP:" + meetingEndTime + "\n"
+ "CATEGORIES:Meeting\n"
+ "DESCRIPTION:This the description of the meeting.\n\n"
+ "SUMMARY:Test meeting request\n" + "PRIORITY:1\n"
+ "CLASS:PUBLIC\n" + "BEGIN:VALARM\n"
+ "TRIGGER:PT1440M\n" + "ACTION:DISPLAY\n"
+ "DESCRIPTION:Reminder\n" + "END:VALARM\n"
+ "END:VEVENT\n" + "END:VCALENDAR");
messageBodyPart.setFileName("meeting.ics");
messageBodyPart.setDataHandler(new DataHandler(new ByteArrayDataSource(buffer.toString(), "text/iCalendar")));
messageBodyPart.setHeader("Content-Class","urn:content-classes:calendarmessage");
messageBodyPart.setHeader("Content-ID", "calendar_message");
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
message.setContent(multipart);
Transport.send(message);
}

catch (Exception e) {
e.printStackTrace();
}
}

public String getReviewTime(Date reviewDateTime, boolean flag)
{
Calendar c = Calendar.getInstance();
SimpleDateFormat s = new SimpleDateFormat("yyyyMMdd");
c.setTime(reviewDateTime);

if (flag)
c.add(Calendar.MINUTE, 30);

String hour = c.get(Calendar.HOUR_OF_DAY) < 10 ? "0"
+ c.get(Calendar.HOUR_OF_DAY) : ""
+ c.get(Calendar.HOUR_OF_DAY);
String min = c.get(Calendar.MINUTE) < 10 ? "0" + c.get(Calendar.MINUTE)
: "" + c.get(Calendar.MINUTE);
String sec = c.get(Calendar.SECOND) < 10 ? "0" + c.get(Calendar.SECOND)
: "" + c.get(Calendar.SECOND);
String date = s.format(new Date(c.getTimeInMillis()));
String dateTime = date + "T" + hour + min + sec + "Z";
return dateTime;
}

private class ByteArrayDataSource implements DataSource
{
private byte[] data; // data for mail message

private String type; // content type/mime type
ByteArrayDataSource(String data, String type)
{
try
{
// Assumption that the string contains only ascii
// characters ! Else just pass in a charset into this
// constructor and use it in getBytes()
this.data = data.getBytes("iso-8859-1");
}
catch (Exception e)
{
e.printStackTrace();
}
this.type = type;
}

// DataSource interface methods
public InputStream getInputStream() throws IOException
{
if (data == null)
throw new IOException("no data exception in ByteArrayDataSource");
return new ByteArrayInputStream(data);
}

public OutputStream getOutputStream() throws IOException
{
throw new IOException("illegal operation in ByteArrayDataSource");
}

public String getContentType()
{
return type;
}

public String getName()
{
return "dummy";
}
}

Regards,
Vidi
Nov 3 '09 #4
Thank you, your post was very helpful. I could manage to send meeting request using the code you posted.
Apr 17 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Akira | last post by:
Could someone tell me how to send outlook appointment email from asp page? I would like appointment email just like one outlook can send out. I tried to look for an answer for this, but it seems...
2
by: Kamyk | last post by:
Hello all! I have created a function in VB which generate appointment in Outlook. Everything is OK, except one thing. I cannot send it automatically using a button in Access, because I don`t...
2
by: James | last post by:
Is it possible for me to generate Outlook objects in an ASP.NET application on a web server (like a calander event for example) and then attach that object to an email so that the recipient can...
0
by: Kevin | last post by:
I am successfully creating and deleting appointments and sending invitations in a C# / ASP.NET / Exchange2000 environment. It works great! But the problem is that no notifications are sent out...
1
by: Owen | last post by:
Hello, I am working on a project that required to implement sending meeting requests with an attachment. I have researched many posts from web, but I cannot see any one talking about how to...
0
by: mark.kishel | last post by:
I would like to send an meeting request via email similar to google calendar using asp.net(VB). I have attached the ics file but it still shows up as an attachment, outlook will not recognize it...
6
by: Rushwire | last post by:
Does anybody know how to send a meeting request using an ics/vcs (VCalendar) attachment from an asp.net page. I don't want my users to have to double click on the attachment but rather that it is...
10
by: mofmans2ndcoming | last post by:
I have a script for my companies internal network that I am developing to ease the transition away from out old conference room scheduling system to outlook. (this is a stop gap until we can get...
2
by: Vighneswar | last post by:
Hi All I am doing with a standalone application in .NET, where I have to invoke the Outlook / Outlook Express by passing account info (username, password, pop3 server, ... etc) and SQL Server...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.