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

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