EWS

pub build coverage license

This project is a Dart client library to access Microsoft Exchange web services. The library works against Office 365 Exchange Online as well as on premises Exchange. By using it you can access almost all the information stored in an Office 365, Exchange Online, or Exchange Server mailbox. However, this API is in sustaining mode, the recommended access pattern for Office 365 and Exchange online data is Microsoft Graph

Getting started

In the library the ExchangeService class contains the methods and properties that are used to set user credentials, identify the Exchange Web Services endpoint, send and receive SOAP messages, and configure the connection with Exchange Web Services. To perform an operation by using the library, you must set up the ExchangeService class.

final service = ExchangeService.withVersion(ExchangeVersion.Exchange2007_SP1)
    ..Url = Uri.parse("https://outlook.office365.com/ews/exchange.asmx")
    ..Credentials = WebCredentials("---USER_NAME---", "---USER_PASSWORD---", "---USER_DOMAIN---");

Creating folders

The following code example shows how to create a folder with a custom folder class.

final folder = new Folder(service)
    ..DisplayName = "Custom Folder"
    ..FolderClass = "IPF.MyCustomFolderClass";
await folder.SaveWithWellKnownFolderName(WellKnownFolderName.Notes);

Creating custom extended properties

The following code example shows how to create a new extended property, set a value for the extended property, and add it to a message.

// Create a definition for the extended property.
final extendedPropertyDefinition = ExtendedPropertyDefinition.withDefaultPropertySetAndName(DefaultExtendedPropertySet.Common, "custom:MeetingDescription", MapiPropertyType.String);

// Create an e-mail message that you will add the extended property to.
final message = new EmailMessage(service)
    ..Subject = "Saved with the meeting description"
    ..Body = MessageBody.withText("The meeting description is contained within the extended property.")
    ..ToRecipients.Add(EmailAddress(smtpAddress: "user@contoso.com"))
    ..SetExtendedProperty(extendedPropertyDefinition, "The meeting purpose is make the right decision");

// Save the e-mail message.
await message.SendAndSaveCopy();

Creating an appointment

The following code shows how to create an appointment and set a subject, a body, a start time, and an end time to one.

final startTime = new DateTime(2019, 9, 9, 9, 10, 0);
final appointment = new Appointment(service)
  ..Subject = "Dentist Appointment"
  ..Body = MessageBody.withText("The appointment is with Dr. Smith.")
  ..Start = startTime
  ..End = startTime.add(Duration(hours: 2));

await appointment.SaveWithSendInvitationsMode(SendInvitationsMode.SendToNone);

Support statement

Starting July 19th 2018, Exchange Web Services (EWS) will no longer receive feature updates. While the service will continue to receive security updates and certain non-security updates, product design and features will remain unchanged. This change also applies to the EWS SDKs for Java and .NET. More information here: https://developer.microsoft.com/en-us/graph/blogs/upcoming-changes-to-exchange-web-services-ews-api-for-office-365/

Additional resources

See the following articles to help you get started:

Documentation

Documentation for the EWS Managed API is available in the Web services node of the MSDN Library. In addition to the getting started links provided, you can find how to topics and code samples for the most frequently used EWS Managed API objects in the Develop node. All the latest information about the EWS Managed API, EWS, and related web services can be found under the Explore the EWS Managed API, EWS, and web services in Exchange topic on MSDN.

Libraries

AbsoluteDateTransition
AbsoluteDayOfMonthTransition
AbsoluteMonthTransition
AbstractFolderIdWrapper
AbstractItemIdWrapper
AcceptMeetingInvitationMessage
AffectedTaskOccurrence
AggregateType
Appointment
AppointmentOccurrenceId
AppointmentSchema
AppointmentType
ApprovalRequestData
ArchiveTag
ArgumentNullException
Attachment
AttachmentCollection
AttachmentsPropertyDefinition
Attendee
AttendeeCollection
AttendeeInfo
AttributedString
AttributedStringCollection
Attribution
AttributionCollection
AutodiscoverEndpoints
AutodiscoverErrorCode
AutodiscoverResponseType
AvailabilityData
BasePropertySet
BatchServiceResponseException
BodyType
BoolPropertyDefinition
CalendarActionResults
CalendarFolder
CalendarResponseMessage
CalendarResponseMessageBase
CalendarResponseObjectSchema
CalendarView
CancelMeetingMessage
CancelMeetingMessageSchema
Change
ChangeCollection
ChangeType
ClientAccessTokenType
ClientExtensionProvidedTo
ComparisonMode
CompleteName
ComplexProperty
ComplexPropertyCollection
ComplexPropertyDefinition
ComplexPropertyDefinitionBase
ConflictResolutionMode
ConflictType
ConnectingIdType
ConnectionFailureCause
ConsentState
Contact
ContactGroupSchema
ContactSchema
ContactSource
ContactsFolder
ContainedPropertyDefinition
ContainmentMode
ConversationAction
ConversationFlagStatus
ConversationId
ConversationQueryTraversal
ConversationSchema
ConversationSortOrder
CookieContainer
CreateAttachmentException
CreateAttachmentRequest
CreateAttachmentResponse
CreateFolderRequest
CreateFolderResponse
CreateItemRequest
CreateItemRequestBase
CreateItemResponse
CreateItemResponseBase
CreateRequest
CreateResponseObjectRequest
CreateResponseObjectResponse
DateTimePrecision
DateTimePropertyDefinition
DayOfTheWeek
DayOfTheWeekIndex
DeclineMeetingInvitationMessage
DefaultExtendedPropertySet
DelegateFolderPermissionLevel
DelegateTypes
DeleteAttachmentException
DeleteAttachmentRequest
DeleteAttachmentResponse
DeleteFolderRequest
DeleteItemRequest
DeleteMode
DeleteRequest
DeletedOccurrenceInfo
DeletedOccurrenceInfoCollection
DictionaryEntryProperty
DictionaryProperty
DomainSettingName
DoublePropertyDefinition
EffectiveRights
EffectiveRightsPropertyDefinition
ElcFolderType
EmailAddress
EmailAddressCollection
EmailAddressDictionary
EmailAddressEntry
EmailAddressKey
EmailMessage
EmailMessageSchema
EmailPosition
EndDateRecurrenceRange
EnhancedLocation
EnumToString
Enumerations
EventType
EwsEnumAttribute
EwsHttpWebRequest
EwsHttpWebRequestFactory
EwsHttpWebResponse
EwsServiceMultiResponseXmlReader
EwsServiceXmlReader
EwsServiceXmlWriter
EwsTraceListener
EwsUtilities
EwsXmlReader
ExchangeCredentials
ExchangeServerInfo
ExchangeService
ExchangeServiceBase
ExchangeVersion
ExtendedProperty
ExtendedPropertyCollection
ExtendedPropertyDefinition
ExtensionInstallScope
ExtensionType
FileAsMapping
FileAttachment
Filters
FindFolderRequest
FindFolderResponse
FindFoldersResults
FindItemRequest
FindItemResponse
FindItemsResults
FindRequest
Flag
FlaggedForAction
Folder
FolderChange
FolderEvent
FolderId
FolderIdCollection
FolderIdWrapper
FolderIdWrapperList
FolderPermission
FolderPermissionCollection
FolderPermissionLevel
FolderPermissionReadAccess
FolderSchema
FolderTraversal
FolderView
FolderWrapper
FreeBusyViewType
GenericPropertyDefinition
GetAttachmentRequest
GetAttachmentResponse
GetEventsResults
GetFolderRequest
GetFolderRequestBase
GetFolderRequestForLoad
GetFolderResponse
GetItemRequest
GetItemRequestBase
GetItemRequestForLoad
GetItemResponse
GetRequest
GetStreamingEventsRequest
GetStreamingEventsResponse
GetStreamingEventsResults
GetUserPhotoStatus
GroupMember
GroupMemberCollection
GroupedFindItemsResults
Grouping
HangingServiceRequestBase
HighlightTerm
HoldAction
HoldStatus
HttpRequestHeader
ICalendarActionProvider
IComplexPropertyChangedDelegate
ICreateComplexPropertyDelegate
ICredentials
ICustomUpdateSerializer
IDisposable
IEwsHttpWebRequest
IEwsHttpWebRequestFactory
IEwsHttpWebResponse
IFileAttachmentContentHandler
IGetObjectInstanceDelegate
IOwnedProperty
ISearchStringProvider
ISelfValidate
IServiceObjectChangedDelegate
ITraceListener
IWebProxy
IconIndex
IdFormat
ImAddressDictionary
ImAddressEntry
ImAddressKey
Importance
IndexedPropertyDefinition
IntPropertyDefinition
InvalidOperationException
Item
ItemAttachment
ItemChange
ItemCollection
ItemEvent
ItemFlagStatus
ItemGroup
ItemId
ItemIdCollection
ItemIdWrapper
ItemIdWrapperList
ItemSchema
ItemTraversal
ItemView
ItemWrapper
LazyMember
LegacyFreeBusyStatus
LobbyBypass
LocationSource
LogicalOperator
Mailbox
MailboxSearchLocation
MailboxSearchScopeType
MailboxType
MapiPropertyType
MapiTypeConverter
MapiTypeConverterMapEntry
MeetingAttendeeType
MeetingCancellation
MeetingCancellationSchema
MeetingMessage
MeetingMessageSchema
MeetingRequest
MeetingRequestSchema
MeetingRequestType
MeetingRequestsDeliveryScope
MeetingResponse
MeetingResponseSchema
MeetingTimeZone
MeetingTimeZonePropertyDefinition
MemberStatus
MemoryStream
MessageBody
MessageDisposition
MimeContent
MimeContentBase
Month
MultiResponseServiceRequest
NameResolution
NameResolutionCollection
NoEndRecurrenceRange
NotImplementedException
NotSupportedException
NotificationEvent
NotificationEventArgs
Nullable
NumberedRecurrenceRange
OccurrenceInfo
OccurrenceInfoCollection
OffsetBasePoint
OnlineMeetingAccessLevel
OnlineMeetingSettings
OofExternalAudience
OofState
OrderByCollection
OutParam
OutlookProtocolType
PagedView
Param
PeopleQueryContextKeys
PeopleQuerySource
PermissionCollectionPropertyDefinition
PermissionScope
PersonaPostalAddress
PersonaSchema
PhoneCallState
PhoneNumberDictionary
PhoneNumberEntry
PhoneNumberKey
PhysicalAddressDictionary
PhysicalAddressEntry
PhysicalAddressIndex
PhysicalAddressKey
PostItemSchema
PostReplySchema
Presenters
PreviewItemBaseShape
PrivilegedLogonType
PropertyBag
PropertyDefinition
PropertyDefinitionBase
PropertyDefinitionFlags
PropertyException
PropertySet
Recurrence
Recurrence.IntervalPattern
Recurrence.MonthlyPattern
RecurrencePropertyDefinition
RecurrenceRange
RecurringAppointmentMasterId
ReferenceAttachment
RelativeDayOfMonthTransition
ResolveNameSearchLocation
ResolveNamesRequest
ResolveNamesResponse
ResponseActions
ResponseMessage
ResponseMessageSchema
ResponseMessageType
ResponseObject
ResponseObjectSchema
ResponseType
RetentionActionType
RetentionTagBase
RetentionType
RuleErrorCode
RuleProperty
ScopedDateTimePropertyDefinition
SearchFilter
SearchFilter.ContainsSubstring
SearchFilter.ExcludesBitmask
SearchFilter.Exists
SearchFilter.IsEqualTo
SearchFilter.IsGreaterThan
SearchFilter.IsGreaterThanOrEqualTo
SearchFilter.IsLessThan
SearchFilter.IsLessThanOrEqualTo
SearchFilter.IsNotEqualTo
SearchFilter.Not
SearchFilter.PropertyBasedFilter
SearchFilter.RelationalFilter
SearchFilter.SearchFilterCollection
SearchFolder
SearchFolderParameters
SearchFolderSchema
SearchFolderTraversal
SearchPageDirection
SearchResultType
SeekToConditionItemView
SendCancellationsMode
SendInvitationsMode
SendInvitationsOrCancellationsMode
SendItemRequest
SendPrompt
Sensitivity
ServerBusyException
ServiceError
ServiceErrorHandling
ServiceId
ServiceLocalException
ServiceObject
ServiceObjectDefinitionAttribute
ServiceObjectInfo
ServiceObjectPropertyDefinition
ServiceObjectPropertyException
ServiceObjectSchema
ServiceObjectType
ServiceRemoteException
ServiceRequestBase
ServiceRequestException
ServiceResponse
ServiceResponseCollection
ServiceResponseException
ServiceResult
ServiceValidationException
ServiceVersionException
ServiceXmlDeserializationException
ServiceXmlSerializationException
SetClientExtensionActionId
SimplePropertyBag
SimpleServiceRequestBase
SoapFaultDetails
SortDirection
StandardUser
StartTimeZonePropertyDefinition
StreamingSubscription
StreamingSubscriptionConnection
StringList
StringPropertyDefinition
StringUtils
SubscribeRequest
SubscribeResponse
SubscribeToStreamingNotificationsRequest
SubscriptionBase
SubscriptionErrorEventArgs
SuggestionQuality
SyncFolderHierarchyRequest
SyncFolderHierarchyResponse
SyncFolderItemsRequest
SyncFolderItemsResponse
SyncFolderItemsScope
SyncResponse
Task
TaskDelegationState
TaskDelegationStatePropertyDefinition
TaskMode
TaskSchema
TaskStatus
TasksFolder
TextBody
Time
TimeChange
TimeChangeRecurrence
TimeSpan
TimeSpanPropertyDefinition
TimeZoneConversionException
TimeZoneDefinition
TimeZonePeriod
TimeZonePropertyDefinition
TimeZoneTransition
TimeZoneTransitionGroup
TraceFlags
TypedPropertyDefinition
UniqueBody
UnsubscribeRequest
UpdateFolderRequest
UpdateFolderResponse
UpdateItemRequest
UpdateItemResponse
UserId
ViewBase
ViewFilter
WebCredentials
WebException
WebExceptionStatus
WebHeaderCollection
WellKnownFolderName
X509CertificateCollection
XMLStreamWriter
XmlAttributeNames
XmlElementNames
XmlException
XmlNamespace
XmlNode
XmlNodeType
XmlReader
XmlWriter
ews