|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.moyosoft.exchange.Exchange
public class Exchange
Provides access to the Exchange server. An Exchange object is the starting point for connecting and accessing the Microsoft Exchange server, its data, folders and items.
The Exchange class constructor connects to the server using the specified hostname, credentials and domain. Usage example:
Exchange exchange = new Exchange("hostname", "username", "password");
System.out.println("Exchange server version is: " + exchange.getExchangeVersion());
Exchange(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
Nested Class Summary | |
---|---|
static class |
Exchange.Settings
|
Constructor Summary | |
---|---|
Exchange(java.lang.String hostname,
java.lang.String username,
java.lang.String password)
Connects to the Exchange server using the specified parameters over a secure SSL channel. |
|
Exchange(java.lang.String hostname,
java.lang.String username,
java.lang.String password,
boolean useHttps)
Connects to the Exchange server using the specified parameters. |
|
Exchange(java.lang.String hostname,
java.lang.String username,
java.lang.String password,
java.lang.String domain)
Connects to the Exchange server using the specified parameters over a secure SSL channel. |
|
Exchange(java.lang.String hostname,
java.lang.String username,
java.lang.String password,
java.lang.String domain,
boolean useHttps)
Connects to the Exchange server using the specified parameters. |
|
Exchange(java.lang.String hostname,
java.lang.String username,
java.lang.String password,
java.lang.String domain,
java.lang.String url)
Connects to the Exchange server using the specified parameters and the specified URL string. |
Method Summary | |
---|---|
ExchangeNotificationWatermark |
addNewMailListener(ExchangeNewMailListener listener)
Adds a listener that will be notified when a new mail is received in the Inbox folder. |
ExchangeNotificationWatermark |
addNewMailListener(ExchangeNewMailListener listener,
java.lang.String watermark)
Adds a listener that will be notified when a new mail is received in the Inbox folder. |
void |
checkNewNotifications()
Forces new notifications to be pulled (when using the Pull method) without waiting the configured pulling period. |
void |
configureNotificationsPushStatusUpdateFrequency(int statusUpdateFrequencyInMinutes)
|
void |
configureNotificationsUsingPull()
Configures notification events to be pulled periodically from the Exchange server. |
void |
configureNotificationsUsingPull(int period)
Configures notification events to be pulled periodically from the Exchange server. |
void |
configureNotificationsUsingPush(int portNumber)
Configures notification events to be pushed from the Exchange server to an internal HTTP server. |
void |
configureNotificationsUsingPush(int portNumber,
java.lang.String pushServerHostname)
Configures notification events to be pushed from the Exchange server to an internal HTTP server. |
void |
configureNotificationsUsingPush(int portNumber,
java.lang.String pushServerHostname,
boolean useHttps)
Configures notification events to be pushed from the Exchange server to an internal HTTP server. |
ExchangeNotificationHandler |
configureNotificationsUsingPush(java.lang.String pushServerUrl)
Configures notification events to be pushed from the Exchange server to the specified URL. |
ExchangeCalendarItem |
createCalendarItem()
Creates a new calendar item (appointment) in the user's default calendar folder. |
ExchangeMail |
createMail()
Creates a new email object that can be filled and sent out. |
ExchangeFolder |
getCalendarFolder()
Returns the user's Calendar folder. |
ExchangeServiceClient |
getClient()
Returns the current HTTP client used to send requests and receive responses to/from the Exchange server. |
ExchangeFolder |
getContactsFolder()
Returns the user's Contacts folder. |
ExchangeFolder |
getDelegatedFolder(FolderType folderType,
java.lang.String mailboxEmailAddress)
Returns a folder of another user using Delegate Access. |
ExchangeFolder |
getDeletedItemsFolder()
Returns the user's Deleted items folder. |
java.lang.String |
getExchangeFullVersion()
Returns the full Exchange version including the build numbers. |
java.lang.String |
getExchangeVersion()
Returns the major and minor version numbers separated by a dot. |
ExchangeFolder |
getFolder(FolderType folderType)
Returns the logged user's folder corresponding to the specified type. |
ExchangeFolder |
getFolder(java.lang.String folderId)
Returns an Exchange folder identified by the specified ID or null if the folder is not found. |
ExchangeFolder |
getInboxFolder()
Returns the user's Inbox folder containing received messages. |
ExchangeItem |
getItem(java.lang.String itemId)
Returns an Exchange item identified by the specified ID or null if the item is not found. |
ExchangeFolder |
getNotesFolder()
Returns the user's Notes folder. |
ExchangeFolder |
getRootFolder()
Returns the logged user's root folder. |
ExchangeFolder |
getRootFolder(java.lang.String folderPath)
Returns a sub-folder of the root folder (FolderType.Root) for the specified name or path. |
FoldersCollection |
getRootFolders()
Returns a collection containing the root folder's sub-folders. |
ExchangeFolder |
getSentItemsFolder()
Returns the user's Sent items folder. |
ExchangeFolder |
getTasksFolder()
Returns the user's Tasks folder. |
ExchangeFolder |
getTopFolder()
Returns the 'Top of Information Store' folder of the logged user. |
ExchangeFolder |
getTopFolder(java.lang.String folderPath)
Returns a sub-folder of the 'Top of Information Store' folder (FolderType.MsgFolderRoot) for the specified name or path. |
FoldersCollection |
getTopFolders()
Returns a collection containing the 'Top of Information Store' folder's sub-folders. |
OutOfOfficeSettings |
getUserOutOfOfficeSettings(java.lang.String mailboxEmailAddress)
Returns a mailbox's Out of Office settings and messages. |
UsersAvailability |
getUsersAvailability(java.util.Date startDate,
java.util.Date endDate)
Returns information on users and rooms availability between the specified dates. |
UsersAvailability |
getUsersAvailability(java.util.Date startDate,
java.util.Date endDate,
int freeBusyIntervalInMinutes)
Returns information on users and rooms availability between the specified dates. |
void |
removeNewMailListener(ExchangeNewMailListener listener)
Removes a listener. |
void |
removeNotificationSubscription(java.lang.String subscriptionId)
Removes the specified notification subscription. |
java.lang.Iterable<ExchangeMailbox> |
resolveNames(java.lang.String unresolved)
Resolves the specified name to a list of mailboxes. |
java.lang.Iterable<ExchangeMailbox> |
resolveNames(java.lang.String unresolved,
boolean includeContactData)
Resolves the specified name to a list of mailboxes. |
void |
setClient(ExchangeServiceClient client)
Changes the HTTP client used to send requests and receive responses to/from the Exchange server. |
void |
setImpersonationUsingPrimarySmtpAddress(java.lang.String primarySmtpAddress)
Defines a user's primary SMTP address to be used as Exchange Impersonation method. |
void |
setImpersonationUsingSecurityIdentifier(java.lang.String securityIdentifier)
Defines a security identifier to be used as Exchange Impersonation method. |
void |
setImpersonationUsingUserPricipalName(java.lang.String userPricipalName)
Defines a user's principal name to be used as Exchange Impersonation method. |
void |
setTimeZone(java.util.TimeZone timeZone)
|
void |
stopNotifications()
Cleans up the notification system. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Exchange(java.lang.String hostname, java.lang.String username, java.lang.String password) throws ExchangeServiceException
ExchangeServiceException
- if any errors occur when establishing the communication with Exchange.public Exchange(java.lang.String hostname, java.lang.String username, java.lang.String password, boolean useHttps) throws ExchangeServiceException
ExchangeServiceException
- if any errors occur when establishing the communication with Exchange.public Exchange(java.lang.String hostname, java.lang.String username, java.lang.String password, java.lang.String domain) throws ExchangeServiceException
ExchangeServiceException
- if any errors occur when establishing the communication with Exchange.public Exchange(java.lang.String hostname, java.lang.String username, java.lang.String password, java.lang.String domain, boolean useHttps) throws ExchangeServiceException
ExchangeServiceException
- if any errors occur when establishing the communication with Exchange.public Exchange(java.lang.String hostname, java.lang.String username, java.lang.String password, java.lang.String domain, java.lang.String url) throws ExchangeServiceException
ExchangeServiceException
- if any errors occur when establishing the communication with Exchange.Method Detail |
---|
public ExchangeFolder getFolder(FolderType folderType) throws ExchangeServiceException
For example, to access the Inbox folder, the following code can be used:
Exchange exchange = new Exchange("hostname", "username", "password");
ExchangeFolder folder = exchange.getFolder(FolderType.Inbox);
System.out.println("Inbox name is: " + folder.getDisplayName());
ExchangeServiceException
- if any errors occur during the communication with Exchange.public ExchangeFolder getRootFolder(java.lang.String folderPath) throws ExchangeServiceException
This method returns the same result as:
getFolder(FolderType.Root).getFolders().get(folderPath);
ExchangeServiceException
- if any errors occur during the communication with Exchange.getFolder(FolderType)
,
getTopFolder(String)
public ExchangeFolder getTopFolder(java.lang.String folderPath) throws ExchangeServiceException
This method returns the same result as:
getFolder(FolderType.MsgFolderRoot).getFolders().get(folderPath);
ExchangeServiceException
- if any errors occur during the communication with Exchange.getFolder(FolderType)
,
getRootFolder(String)
public ExchangeFolder getRootFolder() throws ExchangeServiceException
This method returns the same result as:
getFolder(FolderType.Root);
ExchangeServiceException
- if any errors occur during the communication with Exchange.getFolder(FolderType)
,
getTopFolder()
public ExchangeFolder getTopFolder() throws ExchangeServiceException
This method returns the same result as:
getFolder(FolderType.MsgFolderRoot);
ExchangeServiceException
- if any errors occur during the communication with Exchange.getFolder(FolderType)
,
getRootFolder()
public ExchangeFolder getCalendarFolder() throws ExchangeServiceException
This method returns the same result as:
getFolder(FolderType.Calendar);
ExchangeServiceException
- if any errors occur during the communication with Exchange.getFolder(FolderType)
public ExchangeFolder getContactsFolder() throws ExchangeServiceException
This method returns the same result as:
getFolder(FolderType.Contacts);
ExchangeServiceException
- if any errors occur during the communication with Exchange.getFolder(FolderType)
public ExchangeFolder getDeletedItemsFolder() throws ExchangeServiceException
This method returns the same result as:
getFolder(FolderType.DeletedItems);
ExchangeServiceException
- if any errors occur during the communication with Exchange.getFolder(FolderType)
public ExchangeFolder getInboxFolder() throws ExchangeServiceException
This method returns the same result as:
getFolder(FolderType.Inbox);
ExchangeServiceException
- if any errors occur during the communication with Exchange.getFolder(FolderType)
public ExchangeFolder getNotesFolder() throws ExchangeServiceException
This method returns the same result as:
getFolder(FolderType.Notes);
ExchangeServiceException
- if any errors occur during the communication with Exchange.getFolder(FolderType)
public ExchangeFolder getSentItemsFolder() throws ExchangeServiceException
This method returns the same result as:
getFolder(FolderType.SentItems);
ExchangeServiceException
- if any errors occur during the communication with Exchange.getFolder(FolderType)
public ExchangeFolder getTasksFolder() throws ExchangeServiceException
This method returns the same result as:
getFolder(FolderType.Tasks);
ExchangeServiceException
- if any errors occur during the communication with Exchange.getFolder(FolderType)
public FoldersCollection getRootFolders() throws ExchangeServiceException
This method returns the same result as:
getFolder(FolderType.Root).getFolders();
ExchangeServiceException
- if any errors occur during the communication with Exchange.getRootFolder()
,
getRootFolder(String)
,
getTopFolders()
public FoldersCollection getTopFolders() throws ExchangeServiceException
This method returns the same result as:
getFolder(FolderType.MsgFolderRoot).getFolders();
ExchangeServiceException
- if any errors occur during the communication with Exchange.getTopFolder()
,
getTopFolder(String)
,
getRootFolders()
public ExchangeFolder getFolder(java.lang.String folderId) throws ExchangeServiceException
ExchangeServiceException
- if any errors occur during the communication with Exchange.public ExchangeItem getItem(java.lang.String itemId) throws ExchangeServiceException
ExchangeServiceException
- if any errors occur during the communication with Exchange.public ExchangeMail createMail() throws ExchangeServiceException
ExchangeServiceException
- if any errors occur during the communication with Exchange.public ExchangeCalendarItem createCalendarItem() throws ExchangeServiceException
ExchangeServiceException
- if any errors occur during the communication with Exchange.public java.lang.String getExchangeVersion()
"8.0" for Exchange 2007
"8.1" for Exchange 2007 with Service Pack 1
"8.2" for Exchange 2007 with Service Pack 2
"14.0" for Exchange 2010
public java.lang.String getExchangeFullVersion()
"8.1.240.6"
"14.0.639.21"
public void setTimeZone(java.util.TimeZone timeZone)
public ExchangeFolder getDelegatedFolder(FolderType folderType, java.lang.String mailboxEmailAddress) throws ExchangeServiceException
ExchangeServiceException
- if any errors occur during the communication with Exchange.public void setImpersonationUsingUserPricipalName(java.lang.String userPricipalName)
public void setImpersonationUsingSecurityIdentifier(java.lang.String securityIdentifier)
public void setImpersonationUsingPrimarySmtpAddress(java.lang.String primarySmtpAddress)
public OutOfOfficeSettings getUserOutOfOfficeSettings(java.lang.String mailboxEmailAddress) throws ExchangeServiceException
ExchangeServiceException
public UsersAvailability getUsersAvailability(java.util.Date startDate, java.util.Date endDate) throws ExchangeServiceException
ExchangeServiceException
public UsersAvailability getUsersAvailability(java.util.Date startDate, java.util.Date endDate, int freeBusyIntervalInMinutes) throws ExchangeServiceException
ExchangeServiceException
public java.lang.Iterable<ExchangeMailbox> resolveNames(java.lang.String unresolved) throws ExchangeServiceException
ExchangeServiceException
public java.lang.Iterable<ExchangeMailbox> resolveNames(java.lang.String unresolved, boolean includeContactData) throws ExchangeServiceException
includeContactData
- if true detailed contact information are included in the resulting mailboxes; if false, contact data are not queried.
ExchangeServiceException
public ExchangeNotificationWatermark addNewMailListener(ExchangeNewMailListener listener) throws ExchangeServiceException
listener
- the listener to be notified
ExchangeServiceException
public ExchangeNotificationWatermark addNewMailListener(ExchangeNewMailListener listener, java.lang.String watermark) throws ExchangeServiceException
listener
- the listener to be notified
ExchangeServiceException
public void removeNewMailListener(ExchangeNewMailListener listener) throws ExchangeServiceException
listener
- the listener to be removed
ExchangeServiceException
public void configureNotificationsUsingPull(int period) throws ExchangeServiceException
Pulling is the default method used. It is not necessary to call this method except to adjust
the default period or to change the notification method back to Pull.
This method is only available in the Professional edition of the library.
period
- the pulling period in seconds
ExchangeServiceException
public void configureNotificationsUsingPull() throws ExchangeServiceException
Pulling is the default method used. It is not necessary to call this method except to
change the notification method back to Pull.
This method is only available in the Professional edition of the library.
ExchangeServiceException
public ExchangeNotificationHandler configureNotificationsUsingPush(java.lang.String pushServerUrl) throws ExchangeServiceException
pushServerUrl
- the push server URL
ExchangeServiceException
public void configureNotificationsUsingPush(int portNumber, java.lang.String pushServerHostname, boolean useHttps) throws ExchangeServiceException
portNumber
- the TCP port number used to start the local HTTP server.pushServerHostname
- the hostname or IP address of this local server that Exchange will send notifications to.useHttps
- if true, a secure HTTPS connection will be used, otherwise a plain HTTP will be used. Note that notifications do not contain sensitive data (only a numeric ID is transmitted), so using a secure HTTPS channel is not necessary.
ExchangeServiceException
public void configureNotificationsUsingPush(int portNumber, java.lang.String pushServerHostname) throws ExchangeServiceException
portNumber
- the TCP port number used to start the local HTTP server.pushServerHostname
- the hostname or IP address of this local server that Exchange will send notifications to.
ExchangeServiceException
public void configureNotificationsUsingPush(int portNumber) throws ExchangeServiceException
portNumber
- the TCP port number used to start the local HTTP server.
ExchangeServiceException
public void configureNotificationsPushStatusUpdateFrequency(int statusUpdateFrequencyInMinutes) throws ExchangeServiceException
ExchangeServiceException
public void checkNewNotifications() throws ExchangeServiceException
ExchangeServiceException
public void stopNotifications() throws ExchangeServiceException
ExchangeServiceException
public void removeNotificationSubscription(java.lang.String subscriptionId) throws ExchangeServiceException
ExchangeNotificationWatermark.getSubscriptionId()
.
ExchangeServiceException
public ExchangeServiceClient getClient()
ExchangeServiceClient
,
setClient(com.moyosoft.exchange.util.ExchangeServiceClient)
public void setClient(ExchangeServiceClient client)
ExchangeServiceClient
,
getClient()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |