473,395 Members | 1,941 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,395 software developers and data experts.

Using IMAP To Access Calendar on Exchange Server

Hi,

I am fairly new to .NET (coming from a Java background) and I am trying to
port an application that I originally wrote in Java, to .NET / C#. My problem
is that I cannot find a C# analog for the javax.mail library. My original
program used this to access the calendar on Exchange, via IMAP and retrieve
appointments.

I have no idea how to do this. Any help, advice, or even general guidelines
would be much appreciated. I would be very surprised if what I wanted to do
wasn't possible.

Here's a snippet of the original Java code. As you can see, it should be
fairly easy to do:

public void checkCal() {

Folder folder = null;
Store store = null;
// 1. Open the mailbox and retrieve messages
System.out.println("user: " + user + "Password: " + passwd);
URLName url = new URLName(protocol, imapHost, -1, mbox, user, passwd);
Session session = Session.getDefaultInstance(props, null);
session.setDebug(false);
store = session.getStore(url);
store.connect(); //this is a resource that needs to be cleaned up!
folder = store.getDefaultFolder();
folder = folder.getFolder(mbox);
folder.open(Folder.READ_WRITE);
int totalMessages = folder.getMessageCount();

System.out.println("Num Messages=" + totalMessages);
Message[] msgs = folder.getMessages();
FetchProfile fp = new FetchProfile();
fp.add(FetchProfile.Item.ENVELOPE);
folder.fetch(msgs, fp);
}
Jul 21 '05 #1
2 8431
Oops.... what I meant to say was that I couldn't find a .NET analog for
javax.mail.... I am writing the program in C#

"nh_capricorn" wrote:
Hi,

I am fairly new to .NET (coming from a Java background) and I am trying to
port an application that I originally wrote in Java, to .NET / C#. My problem
is that I cannot find a C# analog for the javax.mail library. My original
program used this to access the calendar on Exchange, via IMAP and retrieve
appointments.

I have no idea how to do this. Any help, advice, or even general guidelines
would be much appreciated. I would be very surprised if what I wanted to do
wasn't possible.

Here's a snippet of the original Java code. As you can see, it should be
fairly easy to do:

public void checkCal() {

Folder folder = null;
Store store = null;
// 1. Open the mailbox and retrieve messages
System.out.println("user: " + user + "Password: " + passwd);
URLName url = new URLName(protocol, imapHost, -1, mbox, user, passwd);
Session session = Session.getDefaultInstance(props, null);
session.setDebug(false);
store = session.getStore(url);
store.connect(); //this is a resource that needs to be cleaned up!
folder = store.getDefaultFolder();
folder = folder.getFolder(mbox);
folder.open(Folder.READ_WRITE);
int totalMessages = folder.getMessageCount();

System.out.println("Num Messages=" + totalMessages);
Message[] msgs = folder.getMessages();
FetchProfile fp = new FetchProfile();
fp.add(FetchProfile.Item.ENVELOPE);
folder.fetch(msgs, fp);
}

Jul 21 '05 #2
nh_capricorn wrote:
port an application that I originally wrote in Java, to .NET / C#. My problem
is that I cannot find a C# analog for the javax.mail library.


Wow, the Java code looks quite elegant! I'd be interested to see side by
side compare with .NET

Exchange traditionally used MAPI, and if you do a search on "CDO" you'll
find a lot of information about the object model and what you can do
with it - including managing calendars, but I'm not sure about IMAP.
You're talking "open-standards" here, which don't always sit too well in
the Microsoft world!

One thing I did notice that's funny - the latest Exchange SDK states
that it's "not compatible with .NET" and guess what... you have to use
COM interop! I guess .NET doesn't "rock" quite as hard as we were lead
to believe in the latest press release.

--
Gerry Hickman (London UK)
Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Chuck Anderson | last post by:
Can anyone point me in the right direction? I want to use Php to automate confirmation of someone joining an email list by them replying to an email (so they don't have to have a browser?). I...
5
by: Mike | last post by:
I need to provide an example to upper management on how this works, but I don't have the time to write one. Does someone already have some code (java and c/vc/vc++) that demonstrates java using...
1
by: Kjell Wilhelmsen | last post by:
Hi ... I'm working on a program that's importing/exporting data between our Intranet and our ActiveDirectory and Exchange server. Does anybody out there know how to create a meeting in a users...
5
by: kapila Wijethilaka | last post by:
Can anybody give me details ,codes and urls for developing a web based(Asp.net c#) mail client who uses IMAP4 protocoll to retrieve mails from Exchange server. thanks -Kapila
3
by: Curt_C [MVP] | last post by:
Hey all, I can't seem to find a good link to reading an Exchange (2000) calendar with ASP.NET 1.1 Anyone got a good pointer/starter/link? Thanks -- Curt Christianson site:...
2
by: nh_capricorn | last post by:
Hi, I am fairly new to .NET (coming from a Java background) and I am trying to port an application that I originally wrote in Java, to .NET / C#. My problem is that I cannot find a C# analog for...
14
by: sridhar | last post by:
iam having user account on an exchangeserver. with that can i send an email using python? if iam using the following code iam getting error fromAddress = 'sridhar_kasturi@satyam.com'...
4
by: gregpinero | last post by:
I'm trying to get a list of messages from GMAIL using it's new IMAP access. So far I've tried running this command but it just hangs. Any ideas? I figured that's the first line to run from...
3
by: samvb | last post by:
Hello Gusy, I want to access a local mail server using imap from php. But i was not able to connect at all. I have read many codes but none of them worked for me. Do I need any special "imap" or...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.