When I use MAPI in Python, like so:
import win32com.client
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
Am I actually connecting to the internet for this to work? Since there are no credentials being passed in, I am guessing everything is happening locally? How does this work behind the scene?
You are dealing with a local data, i.e. Outlook (client MAPI subsystem).
In your sample code Outlook is just automated. To be precise, a new Outlook Application
instance is created in the code and then a Session
instanced is acquired by calling the Application.GetNamespace method. The GetNameSpace
method is functionally equivalent to the Session
property.
If you don't use the Logon
method the default mail profile is used. And you don't connect to any service, everything is happening locally unless a non-cached mode of connecting to the Exchange server is used in Outlook.
You can use the SyncObject if you need to synchronize the cached data in Outlook. A Send\Receive
group lets users configure different synchronization scenarios, selecting which folders and which filters apply.