public class GraphExchangeSession extends ExchangeSession
Modifier and Type | Class and Description |
---|---|
protected class |
GraphExchangeSession.Folder |
protected static class |
GraphExchangeSession.FolderId |
static class |
GraphExchangeSession.WellKnownFolderName |
ExchangeSession.Condition, ExchangeSession.Contact, ExchangeSession.ContactPhoto, ExchangeSession.Event, ExchangeSession.FreeBusy, ExchangeSession.Item, ExchangeSession.ItemResult, ExchangeSession.Message, ExchangeSession.MessageList, ExchangeSession.MonoCondition, ExchangeSession.MultiCondition, ExchangeSession.NotCondition, ExchangeSession.Operator
Modifier and Type | Field and Description |
---|---|
protected static String |
ARCHIVE_ROOT |
protected static HashSet<FieldURI> |
FOLDER_PROPERTIES
Default folder properties list
|
protected static String |
USERS_ROOT |
ADDRESSBOOK, alias, CALENDAR, CONTACT_ATTRIBUTES, CONTACTS, currentMailboxPath, DISTRIBUTION_LIST_ATTRIBUTES, DRAFTS, email, FREE_BUSY_INTERVAL, GMT_TIMEZONE, IMAP_MESSAGE_ATTRIBUTES, INBOX, JUNK, lastSentMessageId, LOGGER, LOWER_CASE_INBOX, MAILBOX_BASE, mailPath, MIXED_CASE_INBOX, POP_MESSAGE_ATTRIBUTES, 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... condition)
And search filter.
|
protected void |
appendSubFolders(List<ExchangeSession.Folder> folders,
String parentFolderPath,
GraphExchangeSession.FolderId parentFolderId,
ExchangeSession.Condition condition,
boolean recursive) |
protected ExchangeSession.Contact |
buildContact(String folderPath,
String itemName,
Map<String,String> properties,
String etag,
String noneMatch) |
protected void |
buildSessionInfo(URI uri) |
void |
close()
Close session.
|
ExchangeSession.Condition |
contains(String attributeName,
String value)
Contains condition.
|
void |
copyMessage(ExchangeSession.Message message,
String targetFolder)
Copy message to target folder
|
int |
createFolder(String folderName,
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 message in specified folder.
|
void |
deleteFolder(String folderName)
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 ExchangeSession.Condition |
getCalendarItemCondition(ExchangeSession.Condition dateCondition) |
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.
|
ExchangeSession.Item |
getItem(String folderPath,
String itemName)
Get item named eventName in folder
|
protected Set<String> |
getItemProperties() |
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) |
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.
|
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 folderName,
String targetName)
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... condition)
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.
|
int |
sendEvent(String icsBody)
Build and send the MIME message for the provided ICS event.
|
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, convertContactProperties, convertFlagsToKeywords, convertFlagToKeyword, convertItemNameToEML, convertKeywordToFlag, 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, getSubCalendarFolders, getSubFolders, getVcardBdayFormat, getVTimezone, getZuluDateFormat, isExpired, moveMessages, parseDate, purgeOldestFolderMessages, purgeOldestTrashAndSentMessages, refreshFolder, replaceIcal4Principal, searchEvents, searchEvents, searchEventsOnly, searchMessages, searchMessages, searchTasksOnly, sendMessage
protected static final HashSet<FieldURI> FOLDER_PROPERTIES
protected static final String USERS_ROOT
protected static final String ARCHIVE_ROOT
public GraphExchangeSession(HttpClientAdapter httpClient, O365Token token, String userName)
public void close()
ExchangeSession
close
in class ExchangeSession
public String formatSearchDate(Date date)
ExchangeSession
formatSearchDate
in class ExchangeSession
date
- date objectprotected void buildSessionInfo(URI uri) throws IOException
buildSessionInfo
in class ExchangeSession
IOException
public ExchangeSession.Message createMessage(String folderPath, String messageName, HashMap<String,String> properties, javax.mail.internet.MimeMessage mimeMessage) throws IOException
ExchangeSession
createMessage
in class ExchangeSession
folderPath
- Exchange folder pathmessageName
- message nameproperties
- message properties (flags)mimeMessage
- MIME messageIOException
- when unable to create messagepublic void updateMessage(ExchangeSession.Message message, Map<String,String> properties) throws IOException
ExchangeSession
updateMessage
in class ExchangeSession
message
- Exchange messageproperties
- Webdav properties mapIOException
- on errorpublic void deleteMessage(ExchangeSession.Message message) throws IOException
ExchangeSession
deleteMessage
in class ExchangeSession
message
- Exchange messageIOException
- on errorprotected byte[] getContent(ExchangeSession.Message message) throws IOException
ExchangeSession
getContent
in class ExchangeSession
message
- Exchange messageIOException
- on errorpublic ExchangeSession.MessageList searchMessages(String folderName, Set<String> attributes, ExchangeSession.Condition condition) throws IOException
ExchangeSession
searchMessages
in class ExchangeSession
folderName
- Exchange folder nameattributes
- requested Webdav attributescondition
- search filterIOException
- on errorpublic ExchangeSession.MultiCondition and(ExchangeSession.Condition... condition)
ExchangeSession
and
in class ExchangeSession
condition
- search conditionspublic ExchangeSession.MultiCondition or(ExchangeSession.Condition... condition)
ExchangeSession
or
in class ExchangeSession
condition
- search conditionspublic ExchangeSession.Condition not(ExchangeSession.Condition condition)
ExchangeSession
not
in class ExchangeSession
condition
- search conditionpublic ExchangeSession.Condition isEqualTo(String attributeName, String value)
ExchangeSession
isEqualTo
in class ExchangeSession
attributeName
- logical Exchange attribute namevalue
- attribute valuepublic ExchangeSession.Condition isEqualTo(String attributeName, int value)
ExchangeSession
isEqualTo
in class ExchangeSession
attributeName
- logical Exchange attribute namevalue
- attribute valuepublic ExchangeSession.Condition headerIsEqualTo(String headerName, String value)
ExchangeSession
headerIsEqualTo
in class ExchangeSession
headerName
- MIME header namevalue
- attribute valuepublic ExchangeSession.Condition gte(String attributeName, String value)
ExchangeSession
gte
in class ExchangeSession
attributeName
- logical Exchange attribute namevalue
- attribute valuepublic ExchangeSession.Condition gt(String attributeName, String value)
ExchangeSession
gt
in class ExchangeSession
attributeName
- logical Exchange attribute namevalue
- attribute valuepublic ExchangeSession.Condition lt(String attributeName, String value)
ExchangeSession
lt
in class ExchangeSession
attributeName
- logical Exchange attribute namevalue
- attribute valuepublic ExchangeSession.Condition lte(String attributeName, String value)
ExchangeSession
lte
in class ExchangeSession
attributeName
- logical Exchange attribute namevalue
- attribute valuepublic ExchangeSession.Condition contains(String attributeName, String value)
ExchangeSession
contains
in class ExchangeSession
attributeName
- logical Exchange attribute namevalue
- attribute valuepublic ExchangeSession.Condition startsWith(String attributeName, String value)
ExchangeSession
startsWith
in class ExchangeSession
attributeName
- logical Exchange attribute namevalue
- attribute valuepublic ExchangeSession.Condition isNull(String attributeName)
ExchangeSession
isNull
in class ExchangeSession
attributeName
- logical Exchange attribute namepublic ExchangeSession.Condition exists(String attributeName)
ExchangeSession
exists
in class ExchangeSession
attributeName
- logical Exchange attribute namepublic ExchangeSession.Condition isTrue(String attributeName)
ExchangeSession
isTrue
in class ExchangeSession
attributeName
- logical Exchange attribute namepublic ExchangeSession.Condition isFalse(String attributeName)
ExchangeSession
isFalse
in class ExchangeSession
attributeName
- logical Exchange attribute namepublic List<ExchangeSession.Folder> getSubFolders(String folderPath, ExchangeSession.Condition condition, boolean recursive) throws IOException
ExchangeSession
getSubFolders
in class ExchangeSession
folderPath
- 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
IOException
public void sendMessage(javax.mail.internet.MimeMessage mimeMessage) throws IOException, javax.mail.MessagingException
ExchangeSession
sendMessage
in class ExchangeSession
mimeMessage
- MIME messageIOException
- on errorjavax.mail.MessagingException
- on errorprotected GraphExchangeSession.Folder internalGetFolder(String folderPath) throws IOException
internalGetFolder
in class ExchangeSession
IOException
protected GraphExchangeSession.FolderId getSubFolderByName(GraphExchangeSession.FolderId currentFolderId, String folderName) throws IOException
currentFolderId
- parent folder idfolderName
- child folder nameIOException
- on errorpublic int createFolder(String folderName, String folderClass, Map<String,String> properties) throws IOException
ExchangeSession
createFolder
in class ExchangeSession
folderName
- logical folder namefolderClass
- folder classproperties
- folder propertiesIOException
- on errorpublic int updateFolder(String folderName, Map<String,String> properties) throws IOException
ExchangeSession
updateFolder
in class ExchangeSession
folderName
- logical folder nameproperties
- folder propertiesIOException
- on errorpublic void deleteFolder(String folderName) throws IOException
ExchangeSession
deleteFolder
in class ExchangeSession
folderName
- logical folder nameIOException
- on errorpublic void copyMessage(ExchangeSession.Message message, String targetFolder) throws IOException
ExchangeSession
copyMessage
in class ExchangeSession
message
- Exchange messagetargetFolder
- target folderIOException
- on errorpublic void moveMessage(ExchangeSession.Message message, String targetFolder) throws IOException
ExchangeSession
moveMessage
in class ExchangeSession
message
- Exchange messagetargetFolder
- target folderIOException
- on errorpublic void moveFolder(String folderName, String targetName) throws IOException
ExchangeSession
moveFolder
in class ExchangeSession
folderName
- current folder name/pathtargetName
- target folder name/pathIOException
- on errorpublic void moveItem(String sourcePath, String targetPath) throws IOException
ExchangeSession
moveItem
in class ExchangeSession
sourcePath
- item source pathtargetPath
- item target pathIOException
- on errorprotected void moveToTrash(ExchangeSession.Message message) throws IOException
moveToTrash
in class ExchangeSession
IOException
protected Set<String> getItemProperties()
getItemProperties
in class ExchangeSession
public List<ExchangeSession.Contact> searchContacts(String folderPath, Set<String> attributes, ExchangeSession.Condition condition, int maxCount) throws IOException
ExchangeSession
searchContacts
in class ExchangeSession
folderPath
- Exchange folder pathattributes
- requested attributescondition
- Exchange search querymaxCount
- maximum item countIOException
- on errorpublic List<ExchangeSession.Event> getEventMessages(String folderPath) throws IOException
ExchangeSession
getEventMessages
in class ExchangeSession
folderPath
- Exchange folder pathIOException
- on errorprotected ExchangeSession.Condition getCalendarItemCondition(ExchangeSession.Condition dateCondition)
getCalendarItemCondition
in class ExchangeSession
public List<ExchangeSession.Event> searchEvents(String folderPath, Set<String> attributes, ExchangeSession.Condition condition) throws IOException
ExchangeSession
searchEvents
in class ExchangeSession
folderPath
- Exchange folder pathattributes
- requested attributescondition
- Exchange search queryIOException
- on errorpublic ExchangeSession.Item getItem(String folderPath, String itemName) throws IOException
ExchangeSession
getItem
in class ExchangeSession
folderPath
- Exchange folder pathitemName
- event nameIOException
- on errorpublic ExchangeSession.ContactPhoto getContactPhoto(ExchangeSession.Contact contact) throws IOException
ExchangeSession
getContactPhoto
in class ExchangeSession
contact
- address book contactIOException
- on errorpublic void deleteItem(String folderPath, String itemName) throws IOException
ExchangeSession
deleteItem
in class ExchangeSession
folderPath
- Exchange folder pathitemName
- item nameIOException
- on errorpublic void processItem(String folderPath, String itemName) throws IOException
ExchangeSession
processItem
in class ExchangeSession
folderPath
- Exchange folder pathitemName
- item nameIOException
- on errorpublic int sendEvent(String icsBody) throws IOException
ExchangeSession
sendEvent
in class ExchangeSession
icsBody
- event in iCalendar formatIOException
- on errorprotected ExchangeSession.Contact buildContact(String folderPath, String itemName, Map<String,String> properties, String etag, String noneMatch) throws IOException
buildContact
in class ExchangeSession
IOException
protected ExchangeSession.ItemResult internalCreateOrUpdateEvent(String folderPath, String itemName, String contentClass, String icsBody, String etag, String noneMatch) throws IOException
internalCreateOrUpdateEvent
in class ExchangeSession
IOException
public boolean isSharedFolder(String folderPath)
ExchangeSession
isSharedFolder
in class ExchangeSession
folderPath
- absolute folder pathpublic boolean isMainCalendar(String folderPath) throws IOException
ExchangeSession
isMainCalendar
in class ExchangeSession
folderPath
- absolute folder pathIOException
public Map<String,ExchangeSession.Contact> galFind(ExchangeSession.Condition condition, Set<String> returningAttributes, int sizeLimit) throws IOException
ExchangeSession
galFind
in class ExchangeSession
condition
- search filterreturningAttributes
- returning attributessizeLimit
- size limitIOException
- on errorprotected String getFreeBusyData(String attendee, String start, String end, int interval) throws IOException
ExchangeSession
getFreeBusyData
in class ExchangeSession
attendee
- 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 ExchangeSession
Copyright © 2001–2025 MickaĆ«l Guessant. All rights reserved.