Update of /cvsroot/pywin32/pywin32/com/win32com/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14726
Modified Files:
testExchange.py
Log Message:
Hack into working somewhat on Outlook 2007
Index: testExchange.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testExchange.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** testExchange.py 23 Oct 2005 11:31:35 -0000 1.6
--- testExchange.py 30 Jun 2008 13:50:09 -0000 1.7
***************
*** 8,12 ****
import os
! ammodule = gencache.EnsureModule('{3FA7DEA7-6438-101B-ACC1-00AA00423326}', 0, 1, 1)
def GetDefaultProfileName():
--- 8,12 ----
import os
! ammodule = None # was the generated module!
def GetDefaultProfileName():
***************
*** 33,37 ****
def DumpFolders(session):
! infostores = session.InfoStores
print infostores
print "There are %d infostores" % infostores.Count
--- 33,45 ----
def DumpFolders(session):
! try:
! infostores = session.InfoStores
! except AttributeError:
! # later outlook?
! store = session.DefaultStore
! folder = store.GetRootFolder()
! DumpFolder(folder)
! return
!
print infostores
print "There are %d infostores" % infostores.Count
***************
*** 65,70 ****
def TestUser(session):
ae = session.CurrentUser
! fields = ae.Fields
! print "User has %d fields" % fields.Count
for f in range(len(fields)):
field = fields[f+1]
--- 73,78 ----
def TestUser(session):
ae = session.CurrentUser
! fields = getattr(ae, "Fields", [])
! print "User has %d fields" % len(fields)
for f in range(len(fields)):
field = fields[f+1]
***************
*** 76,91 ****
def test():
- if not ammodule:
- print "MAPI does not appear to be installed on this machine - skipping."
- return
-
import win32com.client
oldcwd = os.getcwd()
- session = win32com.client.Dispatch("MAPI.Session")
try:
! session.Logon(GetDefaultProfileName())
! except pythoncom.com_error, details:
! print "Could not log on to MAPI:", details
! return
try:
TestUser(session)
--- 84,101 ----
def test():
import win32com.client
oldcwd = os.getcwd()
try:
! session = gencache.EnsureDispatch("MAPI.Session")
! try:
! session.Logon(GetDefaultProfileName())
! except pythoncom.com_error, details:
! print "Could not log on to MAPI:", details
! return
! except pythoncom.error:
! # no mapi.session - let's try outlook
! app = gencache.EnsureDispatch("Outlook.Application")
! session = app.Session
!
try:
TestUser(session)
|