public class GraphExchangeSession extends ExchangeSession
| Modifier and Type | Class and Description |
|---|---|
protected class |
GraphExchangeSession.Contact |
protected class |
GraphExchangeSession.Event |
protected static class |
GraphExchangeSession.ExistsCondition |
protected class |
GraphExchangeSession.Folder
Graph folder is identified by mailbox and id
|
protected static class |
GraphExchangeSession.FolderId |
protected static class |
GraphExchangeSession.HeaderCondition |
protected static class |
GraphExchangeSession.IsNullCondition |
static class |
GraphExchangeSession.WellKnownFolderName |
ExchangeSession.Condition, ExchangeSession.ContactPhoto, ExchangeSession.FreeBusy, ExchangeSession.Item, ExchangeSession.ItemResult, ExchangeSession.MessageList, ExchangeSession.MonoCondition, ExchangeSession.Operator| Modifier and Type | Field and Description |
|---|---|
protected static String |
APPLICATION_ICS |
protected static String |
ARCHIVE_ROOT |
protected static HashSet<String> |
CALENDAR_ITEM_REQUEST_PROPERTIES |
protected static HashSet<GraphField> |
CONTACT_ATTRIBUTES |
protected static HashSet<GraphField> |
EVENT_ATTRIBUTES |
protected static HashSet<GraphField> |
EVENT_LIST_ATTRIBUTES
EVENT_ATTRIBUTES to retrieve all fields including modified occurences, EVENT_LIST_ATTRIBUTES for search
|
protected static HashSet<String> |
EVENT_REQUEST_PROPERTIES |
protected static HashSet<GraphField> |
FOLDER_PROPERTIES
Default folder properties list
|
static HashMap<String,String> |
GALFIND_ATTRIBUTE_MAP
Map people attributes to LDAP
|
protected static HashSet<GraphField> |
IMAP_MESSAGE_ATTRIBUTES |
protected static Set<String> |
ITEM_PROPERTIES
Common item properties
|
protected static String |
TEXT_CALENDAR |
protected Map<String,String> |
urlcompnameToIdMap |
protected static String |
USERS_ROOT |
protected static HashMap<String,String> |
wellKnownFolderMap |
ADDRESSBOOK, alias, ARCHIVE, CALENDAR, CONTACTS, currentMailboxPath, DISTRIBUTION_LIST_ATTRIBUTES, DRAFTS, email, FREE_BUSY_INTERVAL, GMT_TIMEZONE, importanceToPriorityMap, INBOX, JUNK, lastRcptToRecipients, lastSentMessageId, LOGGER, LOWER_CASE_INBOX, MAILBOX_BASE, mailPath, MIXED_CASE_INBOX, ORG_CONTACT_ATTRIBUTES, POP_MESSAGE_ATTRIBUTES, priorityToImportanceMap, PUBLIC_ROOT, publicFolderUrl, rootPath, SENDMSG, SENT, serverVersion, SPECIAL, TASKS, TRASH, UID_MESSAGE_ATTRIBUTES, UNSENT, userName, vTimezone, YYYY_MM_DD_HH_MM_SS, YYYY_MM_DD_T_HHMMSS_Z| Constructor and Description |
|---|
GraphExchangeSession(HttpClientAdapter httpClient,
O365Token token,
String userName) |
| Modifier and Type | Method and Description |
|---|---|
ExchangeSession.MultiCondition |
and(ExchangeSession.Condition... conditions)
And search filter.
|
protected void |
appendSubFolders(List<ExchangeSession.Folder> folders,
String parentFolderPath,
GraphExchangeSession.FolderId parentFolderId,
ExchangeSession.Condition condition,
boolean recursive) |
protected GraphExchangeSession.Contact |
buildContact(String folderPath,
String itemName,
Map<String,String> properties,
String etag,
String noneMatch) |
protected GraphExchangeSession.Contact |
buildGalfindContact(org.codehaus.jettison.json.JSONObject response) |
protected void |
buildSessionInfo(URI uri) |
void |
close()
Close session.
|
ExchangeSession.Condition |
contains(String attributeName,
String value)
Contains condition.
|
protected static String |
convertDateFromExchange(String exchangeDateValue)
Lightweight conversion method to avoid full string to date and back conversions.
|
protected String |
convertItemNameToEML(String itemName)
convert vcf extension to EML.
|
protected String |
convertItemNameToItemId(String itemName) |
void |
copyMessage(ExchangeSession.Message message,
String targetFolder)
Copy message to target folder
|
int |
createFolder(String folderPath,
String folderClass,
Map<String,String> properties)
Create Exchange folder with given folder class.
|
ExchangeSession.Message |
createMessage(String folderPath,
String messageName,
HashMap<String,String> properties,
javax.mail.internet.MimeMessage mimeMessage)
Create a message in the specified folder.
|
void |
deleteFolder(String folderPath)
Delete Exchange folder.
|
void |
deleteItem(String folderPath,
String itemName)
Delete event named itemName in folder
|
void |
deleteMessage(ExchangeSession.Message message)
Delete Exchange message.
|
ExchangeSession.Condition |
exists(String attributeName)
Exists condition.
|
String |
formatSearchDate(Date date)
Format date to exchange search format.
|
Map<String,ExchangeSession.Contact> |
galFind(ExchangeSession.Condition condition,
Set<String> returningAttributes,
int sizeLimit)
Search global address list
|
protected String |
getCalendarEmail(String folderPath)
Get email from current calendar
|
protected ExchangeSession.Condition |
getCalendarItemCondition(ExchangeSession.Condition dateCondition) |
protected javax.mail.internet.MimePart |
getCalendarMimePart(javax.mail.internet.MimeMultipart multiPart) |
ExchangeSession.ContactPhoto |
getContactPhoto(ExchangeSession.Contact contact)
Retrieve contact photo attached to contact
|
protected byte[] |
getContent(ExchangeSession.Message message)
Get raw MIME message content
|
List<ExchangeSession.Event> |
getEventMessages(String folderPath)
Search calendar messages in provided folder.
|
protected String |
getFreeBusyData(String attendee,
String start,
String end,
int interval)
Get freebusy data string from Exchange.
|
protected byte[] |
getICS(InputStream mimeInputStream)
Load ICS content from MIME message input stream
|
ExchangeSession.Item |
getItem(String folderPath,
String itemName)
Get item named eventName in folder
|
protected Set<String> |
getItemProperties() |
List<ExchangeSession.Folder> |
getSubCalendarFolders(String folderName,
boolean recursive)
Search calendar folders under given folder.
|
protected GraphExchangeSession.FolderId |
getSubFolderByName(GraphExchangeSession.FolderId currentFolderId,
String folderName)
Search subfolder by name, return null when no folders found
|
List<ExchangeSession.Folder> |
getSubFolders(String folderPath,
ExchangeSession.Condition condition,
boolean recursive)
Search folders under given folder matching filter.
|
ExchangeSession.Condition |
gt(String attributeName,
String value)
Greater than condition.
|
ExchangeSession.Condition |
gte(String attributeName,
String value)
Greater than or equals condition.
|
ExchangeSession.Condition |
headerIsEqualTo(String headerName,
String value)
MIME header equals condition.
|
protected ExchangeSession.ItemResult |
internalCreateOrUpdateEvent(String folderPath,
String itemName,
String contentClass,
String icsBody,
String etag,
String noneMatch) |
protected GraphExchangeSession.Folder |
internalGetFolder(String folderPath) |
protected boolean |
isCalendarContentType(String contentType) |
ExchangeSession.Condition |
isEqualTo(String attributeName,
int value)
Equals condition.
|
ExchangeSession.Condition |
isEqualTo(String attributeName,
String value)
Equals condition.
|
ExchangeSession.Condition |
isFalse(String attributeName)
Is false condition.
|
protected static boolean |
isItemId(String itemName)
Check if itemName is long and base64 encoded.
|
boolean |
isMainCalendar(String folderPath)
Test if folderPath is main calendar.
|
ExchangeSession.Condition |
isNull(String attributeName)
Is null condition.
|
boolean |
isSharedFolder(String folderPath)
Test if folderPath is inside user mailbox.
|
ExchangeSession.Condition |
isTrue(String attributeName)
Is true condition.
|
protected void |
loadVtimezone() |
ExchangeSession.Condition |
lt(String attributeName,
String value)
Lower than condition.
|
ExchangeSession.Condition |
lte(String attributeName,
String value)
Lower than or equals condition.
|
void |
moveFolder(String folderPath,
String targetFolderPath)
Move folder to target name.
|
void |
moveItem(String sourcePath,
String targetPath)
Move item from source path to target path.
|
void |
moveMessage(ExchangeSession.Message message,
String targetFolder)
Move message to target folder
|
protected void |
moveToTrash(ExchangeSession.Message message) |
ExchangeSession.Condition |
not(ExchangeSession.Condition condition)
Not search filter.
|
ExchangeSession.MultiCondition |
or(ExchangeSession.Condition... conditions)
Or search filter.
|
void |
processItem(String folderPath,
String itemName)
Mark event processed named eventName in folder
|
List<ExchangeSession.Contact> |
searchContacts(String folderPath,
Set<String> attributes,
ExchangeSession.Condition condition,
int maxCount)
Search contacts in provided folder matching the search query.
|
List<ExchangeSession.Event> |
searchEvents(String folderPath,
Set<String> attributes,
ExchangeSession.Condition condition)
Search calendar events or messages in provided folder matching the search query.
|
ExchangeSession.MessageList |
searchMessages(String folderName,
Set<String> attributes,
ExchangeSession.Condition condition)
Search folder for messages matching conditions, with given attributes.
|
List<ExchangeSession.Event> |
searchTasksOnly(String folderPath)
Tasks folders are no longer supported, reroute to todos.
|
int |
sendEvent(String icsBody)
Build and send the MIME message for the provided ICS event.
|
void |
sendMessage(byte[] byteArray) |
void |
sendMessage(javax.mail.internet.MimeMessage mimeMessage)
Send Mime message.
|
ExchangeSession.Condition |
startsWith(String attributeName,
String value)
Starts with condition.
|
int |
updateFolder(String folderName,
Map<String,String> properties)
Update Exchange folder properties.
|
void |
updateMessage(ExchangeSession.Message message,
Map<String,String> properties)
Update given properties on message.
|
clearVTimezone, convertBDayToZulu, convertClassFromExchange, convertContactProperties, convertFlagsToKeywords, convertFlagToKeyword, convertKeywordToFlag, convertPriorityFromExchange, convertPriorityToExchange, convertResentHeader, convertZuluDateToBday, copyMessages, createCalendarFolder, createContactFolder, createMessageFolder, createOrUpdateContact, createOrUpdateItem, decodeKeyword, encodeKeyword, getADPhoto, getAlias, getAliasFromLogin, getAllContacts, getAllEvents, getAllMessageUidAndSize, getAllRecipients, getEmail, getExchangeDateFormat, getExchangeZuluDateFormat, getExchangeZuluDateFormatMillisecond, getFolder, getFreebusy, getPastDelayCondition, getRangeCondition, getServerVersion, getSubFolders, getTimezoneId, getVcardBdayFormat, getVTimezone, getZuluDateFormat, isExpired, moveMessages, parseDate, purgeOldestFolderMessages, purgeOldestTrashAndSentMessages, refreshFolder, replaceIcal4Principal, searchEvents, searchEvents, searchEventsOnly, searchMessages, searchMessages, sendMessageprotected static final HashSet<GraphField> IMAP_MESSAGE_ATTRIBUTES
protected static final HashSet<GraphField> CONTACT_ATTRIBUTES
protected static final HashSet<GraphField> EVENT_LIST_ATTRIBUTES
protected static final HashSet<GraphField> EVENT_ATTRIBUTES
protected static final HashSet<GraphField> FOLDER_PROPERTIES
protected static final String USERS_ROOT
protected static final String ARCHIVE_ROOT
protected static final HashSet<String> CALENDAR_ITEM_REQUEST_PROPERTIES
protected static final String TEXT_CALENDAR
protected static final String APPLICATION_ICS
public GraphExchangeSession(HttpClientAdapter httpClient, O365Token token, String userName) throws IOException
IOExceptionpublic void close()
ExchangeSessionclose in class ExchangeSessionpublic String formatSearchDate(Date date)
formatSearchDate in class ExchangeSessiondate - date objectprotected void buildSessionInfo(URI uri) throws IOException
buildSessionInfo in class ExchangeSessionIOExceptionpublic ExchangeSession.Message createMessage(String folderPath, String messageName, HashMap<String,String> properties, javax.mail.internet.MimeMessage mimeMessage) throws IOException
ExchangeSessioncreateMessage in class ExchangeSessionfolderPath - Exchange folder pathmessageName - message nameproperties - message properties (flags)mimeMessage - MIME messageIOException - when unable to create messageprotected static String convertDateFromExchange(String exchangeDateValue) throws DavMailException
exchangeDateValue - date returned from O365DavMailException - on errorpublic void updateMessage(ExchangeSession.Message message, Map<String,String> properties) throws IOException
ExchangeSessionupdateMessage in class ExchangeSessionmessage - Exchange messageproperties - Webdav properties mapIOException - on errorpublic void deleteMessage(ExchangeSession.Message message) throws IOException
ExchangeSessiondeleteMessage in class ExchangeSessionmessage - Exchange messageIOException - on errorprotected byte[] getContent(ExchangeSession.Message message) throws IOException
ExchangeSessiongetContent in class ExchangeSessionmessage - Exchange messageIOException - on errorpublic ExchangeSession.MessageList searchMessages(String folderName, Set<String> attributes, ExchangeSession.Condition condition) throws IOException
ExchangeSessionsearchMessages in class ExchangeSessionfolderName - Exchange folder nameattributes - requested Webdav attributescondition - search filterIOException - on errorpublic ExchangeSession.MultiCondition and(ExchangeSession.Condition... conditions)
ExchangeSessionand in class ExchangeSessionconditions - search conditionspublic ExchangeSession.MultiCondition or(ExchangeSession.Condition... conditions)
ExchangeSessionor in class ExchangeSessionconditions - search conditionspublic ExchangeSession.Condition not(ExchangeSession.Condition condition)
ExchangeSessionnot in class ExchangeSessioncondition - search conditionpublic ExchangeSession.Condition isEqualTo(String attributeName, String value)
ExchangeSessionisEqualTo in class ExchangeSessionattributeName - logical Exchange attribute namevalue - attribute valuepublic ExchangeSession.Condition isEqualTo(String attributeName, int value)
ExchangeSessionisEqualTo in class ExchangeSessionattributeName - logical Exchange attribute namevalue - attribute valuepublic ExchangeSession.Condition headerIsEqualTo(String headerName, String value)
ExchangeSessionheaderIsEqualTo in class ExchangeSessionheaderName - MIME header namevalue - attribute valuepublic ExchangeSession.Condition gte(String attributeName, String value)
ExchangeSessiongte in class ExchangeSessionattributeName - logical Exchange attribute namevalue - attribute valuepublic ExchangeSession.Condition gt(String attributeName, String value)
ExchangeSessiongt in class ExchangeSessionattributeName - logical Exchange attribute namevalue - attribute valuepublic ExchangeSession.Condition lt(String attributeName, String value)
ExchangeSessionlt in class ExchangeSessionattributeName - logical Exchange attribute namevalue - attribute valuepublic ExchangeSession.Condition lte(String attributeName, String value)
ExchangeSessionlte in class ExchangeSessionattributeName - logical Exchange attribute namevalue - attribute valuepublic ExchangeSession.Condition contains(String attributeName, String value)
ExchangeSessioncontains in class ExchangeSessionattributeName - logical Exchange attribute namevalue - attribute valuepublic ExchangeSession.Condition startsWith(String attributeName, String value)
ExchangeSessionstartsWith in class ExchangeSessionattributeName - logical Exchange attribute namevalue - attribute valuepublic ExchangeSession.Condition isNull(String attributeName)
ExchangeSessionisNull in class ExchangeSessionattributeName - logical Exchange attribute namepublic ExchangeSession.Condition exists(String attributeName)
ExchangeSessionexists in class ExchangeSessionattributeName - logical Exchange attribute namepublic ExchangeSession.Condition isTrue(String attributeName)
ExchangeSessionisTrue in class ExchangeSessionattributeName - logical Exchange attribute namepublic ExchangeSession.Condition isFalse(String attributeName)
ExchangeSessionisFalse in class ExchangeSessionattributeName - logical Exchange attribute namepublic List<ExchangeSession.Folder> getSubCalendarFolders(String folderName, boolean recursive) throws IOException
ExchangeSessiongetSubCalendarFolders in class ExchangeSessionfolderName - Exchange folder namerecursive - deep search if trueIOException - on errorpublic List<ExchangeSession.Folder> getSubFolders(String folderPath, ExchangeSession.Condition condition, boolean recursive) throws IOException
ExchangeSessiongetSubFolders in class ExchangeSessionfolderPath - Exchange folder namecondition - search filterrecursive - deep search if trueIOException - on errorprotected void appendSubFolders(List<ExchangeSession.Folder> folders, String parentFolderPath, GraphExchangeSession.FolderId parentFolderId, ExchangeSession.Condition condition, boolean recursive) throws IOException
IOExceptionpublic void sendMessage(javax.mail.internet.MimeMessage mimeMessage)
throws IOException,
javax.mail.MessagingException
ExchangeSessionsendMessage in class ExchangeSessionmimeMessage - MIME messageIOException - on errorjavax.mail.MessagingException - on errorpublic void sendMessage(byte[] byteArray)
throws IOException
IOExceptionprotected GraphExchangeSession.Folder internalGetFolder(String folderPath) throws IOException
internalGetFolder in class ExchangeSessionIOExceptionprotected GraphExchangeSession.FolderId getSubFolderByName(GraphExchangeSession.FolderId currentFolderId, String folderName) throws IOException
currentFolderId - parent folder idfolderName - child folder nameIOException - on errorpublic int createFolder(String folderPath, String folderClass, Map<String,String> properties) throws IOException
ExchangeSessioncreateFolder in class ExchangeSessionfolderPath - logical folder namefolderClass - folder classproperties - folder propertiesIOException - on errorpublic int updateFolder(String folderName, Map<String,String> properties) throws IOException
ExchangeSessionupdateFolder in class ExchangeSessionfolderName - logical folder nameproperties - folder propertiesIOException - on errorpublic void deleteFolder(String folderPath) throws IOException
ExchangeSessiondeleteFolder in class ExchangeSessionfolderPath - logical folder nameIOException - on errorpublic void copyMessage(ExchangeSession.Message message, String targetFolder) throws IOException
ExchangeSessioncopyMessage in class ExchangeSessionmessage - Exchange messagetargetFolder - target folderIOException - on errorpublic void moveMessage(ExchangeSession.Message message, String targetFolder) throws IOException
ExchangeSessionmoveMessage in class ExchangeSessionmessage - Exchange messagetargetFolder - target folderIOException - on errorpublic void moveFolder(String folderPath, String targetFolderPath) throws IOException
ExchangeSessionmoveFolder in class ExchangeSessionfolderPath - current folder name/pathtargetFolderPath - target folder name/pathIOException - on errorpublic void moveItem(String sourcePath, String targetPath) throws IOException
ExchangeSessionmoveItem in class ExchangeSessionsourcePath - item source pathtargetPath - item target pathIOException - on errorprotected void moveToTrash(ExchangeSession.Message message) throws IOException
moveToTrash in class ExchangeSessionIOExceptionprotected Set<String> getItemProperties()
getItemProperties in class ExchangeSessionpublic List<ExchangeSession.Contact> searchContacts(String folderPath, Set<String> attributes, ExchangeSession.Condition condition, int maxCount) throws IOException
ExchangeSessionsearchContacts in class ExchangeSessionfolderPath - Exchange folder pathattributes - requested attributescondition - Exchange search querymaxCount - maximum item countIOException - on errorpublic List<ExchangeSession.Event> getEventMessages(String folderPath) throws IOException
ExchangeSessiongetEventMessages in class ExchangeSessionfolderPath - Exchange folder pathIOException - on errorprotected ExchangeSession.Condition getCalendarItemCondition(ExchangeSession.Condition dateCondition)
getCalendarItemCondition in class ExchangeSessionpublic List<ExchangeSession.Event> searchTasksOnly(String folderPath) throws IOException
searchTasksOnly in class ExchangeSessionfolderPath - Exchange folder pathIOException - on errorpublic List<ExchangeSession.Event> searchEvents(String folderPath, Set<String> attributes, ExchangeSession.Condition condition) throws IOException
ExchangeSessionsearchEvents in class ExchangeSessionfolderPath - Exchange folder pathattributes - requested attributescondition - Exchange search queryIOException - on errorprotected boolean isCalendarContentType(String contentType)
protected javax.mail.internet.MimePart getCalendarMimePart(javax.mail.internet.MimeMultipart multiPart)
throws IOException,
javax.mail.MessagingException
IOExceptionjavax.mail.MessagingExceptionprotected byte[] getICS(InputStream mimeInputStream) throws IOException, javax.mail.MessagingException
mimeInputStream - mime message input streamIOException - on errorjavax.mail.MessagingException - on errorpublic ExchangeSession.Item getItem(String folderPath, String itemName) throws IOException
ExchangeSessiongetItem in class ExchangeSessionfolderPath - Exchange folder pathitemName - event nameIOException - on errorprotected String convertItemNameToEML(String itemName)
ExchangeSessionconvertItemNameToEML in class ExchangeSessionitemName - item namepublic ExchangeSession.ContactPhoto getContactPhoto(ExchangeSession.Contact contact) throws IOException
ExchangeSessiongetContactPhoto in class ExchangeSessioncontact - address book contactIOException - on errorpublic void deleteItem(String folderPath, String itemName) throws IOException
ExchangeSessiondeleteItem in class ExchangeSessionfolderPath - Exchange folder pathitemName - item nameIOException - on errorpublic void processItem(String folderPath, String itemName) throws IOException
ExchangeSessionprocessItem in class ExchangeSessionfolderPath - Exchange folder pathitemName - item nameIOException - on errorpublic int sendEvent(String icsBody) throws IOException
ExchangeSessionsendEvent in class ExchangeSessionicsBody - event in iCalendar formatIOException - on errorprotected GraphExchangeSession.Contact buildContact(String folderPath, String itemName, Map<String,String> properties, String etag, String noneMatch) throws IOException
buildContact in class ExchangeSessionIOExceptionprotected ExchangeSession.ItemResult internalCreateOrUpdateEvent(String folderPath, String itemName, String contentClass, String icsBody, String etag, String noneMatch) throws IOException
internalCreateOrUpdateEvent in class ExchangeSessionIOExceptionpublic boolean isSharedFolder(String folderPath)
ExchangeSessionisSharedFolder in class ExchangeSessionfolderPath - absolute folder pathpublic boolean isMainCalendar(String folderPath) throws IOException
ExchangeSessionisMainCalendar in class ExchangeSessionfolderPath - absolute folder pathIOExceptionprotected String getCalendarEmail(String folderPath) throws IOException
ExchangeSessiongetCalendarEmail in class ExchangeSessionfolderPath - calendar folder pathIOExceptionprotected GraphExchangeSession.Contact buildGalfindContact(org.codehaus.jettison.json.JSONObject response)
public Map<String,ExchangeSession.Contact> galFind(ExchangeSession.Condition condition, Set<String> returningAttributes, int sizeLimit) throws IOException
ExchangeSessiongalFind in class ExchangeSessioncondition - search filterreturningAttributes - returning attributessizeLimit - size limitIOException - on errorprotected String getFreeBusyData(String attendee, String start, String end, int interval) throws IOException
ExchangeSessiongetFreeBusyData in class ExchangeSessionattendee - attendee email addressstart - start date in Exchange zulu formatend - end date in Exchange zulu formatinterval - freebusy interval in minutesIOException - on errorprotected void loadVtimezone()
loadVtimezone in class ExchangeSessionprotected static boolean isItemId(String itemName)
itemName - item nameCopyright © 2001–2026 MickaĆ«l Guessant. All rights reserved.