Package: py-ews
Welcome to py-ews's documentation!.______   ____    ____       ___________    __    ____   _______.
    |   _  \  \   \  /   /      |   ____\   \  /  \  /   /  /       |
    |  |_)  |  \   \/   / ______|  |__   \   \/    \/   /  |   (----`
    |   ___/    \_    _/ |______|   __|   \            /    \   \    
    |  |          |  |          |  |____   \    /\    / .----)   |   
    | _|          |__|          |_______|   \__/  \__/  |_______/    
                                                                 


    A Python package to interact with Exchange Web Servicespy-ewsis a cross platform python package to interact with both Exchange 2010 to 2019 on-premises and Exchange Online (Office 365).This package will wrap all Exchange Web Service endpoints, but currently is focused on providing eDiscovery endpoints.Featurespy-ewshas the following notable features in it's current release:Autodiscover supportDelegation supportImpersonation supportOAUth2 supportRetrieve all mailboxes that can be searched based on credentials providedSearch a list of (or single) mailboxes in your Exchange environment using all supported search attributesDelete email items from mailboxes in your Exchange environmentRetrieve mailbox inbox rules for a specific accountFind additional hidden inbox rules for a specified accountPlus more supported endpointsCurrently this package supports the following endpoint's:AddDelegateConvertIdCreateFolderCreateItemDeleteFolderDeleteItemExecuteSearchExpandDLFindFolderFindItemGetAttachmentGetHiddenInboxRulesGetInboxRulesGetItemGetSearchableMailboxesGetServiceConfigurationGetUserSettingsResolveNamesSearchMailboxesSyncFolderHierarchySyncFolderItemsInstallationOS X & Linux:pipinstallpy-ewsWindows:pipinstallpy-ewsCreating EWS ObjectFor convience,py-ewsoffers a simple interface to access all available EWSendpointsin the form of methods.  Each of these methods have
their own required inputs based on the individual endpoint. No matter which endpoint you use, you must first instantiate theEWSclass by providing
authentication details.When instantiating theEWSclass you will need to provide credentials which will be used for all methods within the EWS class.frompyewsimportEWSews=EWS('myaccount@company.com','Password1234')If you would like to use an alternative EWS URL then provide one using theews_urlparameter when instantiating the EWS class.frompyewsimportEWSews=EWS('myaccount@company.com','Password1234',ews_url='https://outlook.office365.com/autodiscover/autodiscover.svc')If you would like to specify a specific version of Exchange to use, you can provide that using theexchange_versionparameter. By defaultpyewswill attempt all Exchange versions as well as multiple static and generated EWS URLs.Finally, if you would like toimpersonate_asa specific user you must provide their primary SMTP address when instantiating theEWSclass object:frompyewsimportEWSews=EWS('myaccount@company.com','Password1234',impersonate_as='myotheraccount@company.com')Exchange Search Multi-ThreadingYou can also specifymulti_threading=Trueand when you search mailboxes we will use multi-threading to perform the search.Using Provided MethodsOnce you have instantiated the EWS class with your credentials, you will have access to pre-exposed methods for each endpoint.  These methods are:get_service_configurationget_searchable_mailboxesget_user_settingsresolve_namesexecute_ews_searchexecute_outlook_searchget_inbox_rulesget_hidden_inbox_rulesget_itemget_attachmentsync_folder_hierarchysync_folder_itemscreate_itemdelete_itemsearch_and_delete_messageget_domain_settingsfind_itemssearch_mailboxes_using_find_itemcreate_search_folderfind_search_folderdelete_search_folderAccess Classes DirectlyIn some cases you may want to skip using theEWSinterface class and build your own wrapper aroundpy-ews.  To do this, you must first import theAuthenticationclass and provide
credential and other details before invoking a desiredendpoint. Below is an example of this:frompyewsimportAuthentication,GetSearchableMailboxesAuthentication('myaccount@company.com','Password1234')reference_id_list=[]formailboxinGetSearchableMailboxes().run():reference_id_list.append(mailbox.get('reference_id'))print(mailbox)As you can see, you must instantiate theAuthenticationclass first before calling an endpoint.  By the way, you can import allendpointsdirectly without using theEWSinterface.For more examples and usage, please refer to the individual class documentationEndpointRelease History1.0.0Initial release of py-ews and it is still considered a work in progress2.0.0Revamped logic and overhauled all endpoints and classes3.0.0Refactored completely - this can be considered a new versionMetaJosh Rickard –@MSAdministratorDistributed under the MIT license. SeeLICENSEfor more information.ContributingFork it (https://github.com/swimlane/pyews/fork)Create your feature branch (git checkout -b feature/fooBar)Commit your changes (git commit -am 'Add some fooBar')Push to the branch (git push origin feature/fooBar)Create a new Pull Request