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
AccountIsLockedException
AffectedTaskOccurrence
AggregateType
AlternateMailbox
AlternateMailboxCollection
Appointment
AppointmentOccurrenceId
AppointmentSchema
AppointmentType
ApprovalRequestData
ArchiveTag
ArgumentException
ArgumentNullException
Attachment
AttachmentCollection
AttachmentsPropertyDefinition
Attendee
AttendeeCollection
AttendeeInfo
AttributedString
AttributedStringCollection
Attribution
AttributionCollection
AutodiscoverDnsClient
AutodiscoverEndpoints
AutodiscoverError
AutodiscoverErrorCode
AutodiscoverLocalException
AutodiscoverRemoteException
AutodiscoverRequest
AutodiscoverResponse
AutodiscoverResponseCollection
AutodiscoverResponseException
AutodiscoverResponseType
AutodiscoverService
AvailabilityData
BasePropertySet
BasicCredentials
BatchServiceResponseException
BodyType
BoolPropertyDefinition
ByteArrayPropertyDefinition
CalendarActionResults
CalendarFolder
CalendarResponseMessage
CalendarResponseMessageBase
CalendarResponseObjectSchema
CalendarView
CancelMeetingMessage
CancelMeetingMessageSchema
Change
ChangeCollection
ChangeType
ClientAccessTokenType
ClientExtensionProvidedTo
ComparisonMode
CompleteName
ComplexProperty
ComplexPropertyCollection
ComplexPropertyDefinition
ComplexPropertyDefinitionBase
ConfigurationSettingsBase
ConflictResolutionMode
ConflictType
ConnectingIdType
ConnectionFailureCause
ConsentState
Contact
ContactGroup
ContactGroupSchema
ContactSchema
ContactsFolder
ContactSource
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
DeletedOccurrenceInfo
DeletedOccurrenceInfoCollection
DeleteFolderRequest
DeleteItemRequest
DeleteMode
DeleteRequest
DictionaryEntryProperty
DictionaryProperty
DocumentSharingLocation
DocumentSharingLocationCollection
DomainSettingError
DomainSettingName
DoublePropertyDefinition
EffectiveRights
EffectiveRightsPropertyDefinition
ElcFolderType
EmailAddress
EmailAddressCollection
EmailAddressDictionary
EmailAddressEntry
EmailAddressKey
EmailMessage
EmailMessageSchema
EmailPosition
EmptyFolderRequest
EndDateRecurrenceRange
EnhancedLocation
Enumerations
EnumToString
EventType
ews
EwsEnumAttribute
EwsHttpClientFactory
EwsHttpWebExceptionResponse
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
    GetDomainSettingsRequest
    GetDomainSettingsResponse
    GetDomainSettingsResponseCollection
    GetEventsResults
    GetFolderRequest
    GetFolderRequestBase
    GetFolderRequestForLoad
    GetFolderResponse
    GetItemRequest
    GetItemRequestBase
    GetItemRequestForLoad
    GetItemResponse
    GetRequest
    GetStreamingEventsRequest
    GetStreamingEventsResponse
    GetStreamingEventsResults
    GetUserPhotoStatus
    GetUserSettingsRequest
    GetUserSettingsResponse
    GetUserSettingsResponseCollection
    GroupedFindItemsResults
    Grouping
    GroupMember
    GroupMemberCollection
    HangingServiceRequestBase
    HangingTraceStream
    HighlightTerm
    HoldAction
    HoldStatus
    HttpRequestHeader
    HttpStatusCode
    ICalendarActionProvider
    IComplexPropertyChangedDelegate
    IconIndex
    ICreateComplexPropertyDelegate
    ICredentials
    ICustomUpdateSerializer
    IdFormat
    IDisposable
    IEwsHttpWebRequest
    IEwsHttpWebRequestFactory
    IEwsHttpWebResponse
    IFileAttachmentContentHandler
    IGetObjectInstanceDelegate
    IHttpClientFactory
    ImAddressDictionary
    ImAddressEntry
    ImAddressKey
    Importance
    IndexedPropertyDefinition
    IntPropertyDefinition
    InvalidOperationException
    IOwnedProperty
    ISearchStringProvider
    ISelfValidate
    IServiceObjectChangedDelegate
    Item
    ItemAttachment
    ItemChange
    ItemCollection
    ItemEvent
    ItemFlagStatus
    ItemGroup
    ItemId
    ItemIdCollection
    ItemIdWrapper
    ItemIdWrapperList
    ItemSchema
    ItemTraversal
    ItemView
    ItemWrapper
    ITraceListener
    IWebProxy
    LazyMember
    LegacyFreeBusyStatus
    LobbyBypass
    LocationSource
    LogicalOperator
    Mailbox
    MailboxSearchLocation
    MailboxSearchScopeType
    MailboxType
    MapiPropertyType
    MapiTypeConverter
    MapiTypeConverterMapEntry
    MeetingAttendeeType
    MeetingCancellation
    MeetingCancellationSchema
    MeetingMessage
    MeetingMessageSchema
    MeetingRequest
    MeetingRequestSchema
    MeetingRequestsDeliveryScope
    MeetingRequestType
    MeetingResponse
    MeetingResponseSchema
    MeetingTimeZone
    MeetingTimeZonePropertyDefinition
    MemberStatus
    MemoryStream
    MessageBody
    MessageDisposition
    MimeContent
    MimeContentBase
    Month
    MultiResponseServiceRequest
    NameResolution
    NameResolutionCollection
    NoEndRecurrenceRange
    NotificationEvent
    NotificationEventArgs
    NotImplementedException
    NotSupportedException
    Nullable
    NumberedRecurrenceRange
    OAuthCredentials
    ObjectDisposedException
    OccurrenceInfo
    OccurrenceInfoCollection
    OffsetBasePoint
    OnlineMeetingAccessLevel
    OnlineMeetingSettings
    OofExternalAudience
    OofState
    OrderByCollection
    OutlookAccount
    OutlookConfigurationSettings
    OutlookProtocol
    OutlookProtocolType
    OutlookUser
    OutParam
    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
    ProtocolConnection
    ProtocolConnectionCollection
    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
    TasksFolder
    TaskStatus
    TextBody
    Time
    TimeChange
    TimeChangeRecurrence
    TimeSpan
    TimeSpanPropertyDefinition
    TimeZoneConversionException
    TimeZoneDefinition
    TimeZonePeriod
    TimeZonePropertyDefinition
    TimeZoneTransition
    TimeZoneTransitionGroup
    TraceFlags
    TypedPropertyDefinition
    UniqueBody
    UnsubscribeRequest
    UpdateFolderRequest
    UpdateFolderResponse
    UpdateItemRequest
    UpdateItemResponse
    UriHelper
    UserId
    UserSettingError
    UserSettingName
    Uuid
    ViewBase
    ViewFilter
    WebClientUrl
    WebClientUrlCollection
    WebException
    WebExceptionStatus
    WebHeaderCollection
    WellKnownFolderName
    X509CertificateCollection
    XmlAttributeNames
    XmlElementNames
    XmlException
    XmlNamespace
    XmlNode
    XmlNodeType
    XmlReader
    XMLStreamWriter
    XmlWriter