GetSearchableMailboxes

This documentation provides details about the GetSearchableMailboxes class within the pyews package.

This class is used to retrieve all searchable mailboxes that the user configuration has access to search.

Identifies all searchable mailboxes based on the provided UserConfiguration object’s permissions

Example:

To use any service class you must provide a UserConfiguration object first.

You can acquire

from pyews import UserConfiguration
from pyews import GetSearchableMailboxes

userconfig = UserConfiguration(
    'first.last@company.com',
    'mypassword123'
)

searchable_mailboxes = GetSearchableMailboxes(userconfig).run()

If you want to use a property from this object with another class then you can iterate through the list of of mailbox properties. For example, if used in conjunction with the SearchMailboxes you first need to create a list of mailbox reference_ids.

id_list = []
for id in searchable_mailboxes.run():
    id_list.append(id.get('reference_id'))
searchResults = SearchMailboxes(userconfig).run('subject:"Phishing Email Subject"', id_list)
Args:
userconfiguration (UserConfiguration): A UserConfiguration object created using the UserConfiguration class