Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Does this work w/ your version of Windows/Outlook ?
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Does this work w/ your version of Windows/Outlook ?
Divers
Thread ID:
00672419
Message ID:
00672419
Vues:
40
Was hoping to find out if this runs on the different versions of Windows and Outlook out there. It does work here with Win98 and Outlook2000, but i dont have a copy of ME, 2000, XP, .... Have found differences when automating Word and am wondering if Outlook is similar.

Code should create a calendar folder called ACME5 under the default outlook "Calendar" folder and create an appointment that starts a week from today.
#DEFINE olAppointmentItem 1
#DEFINE olTaskItem 3
#DEFINE CR CHR(13)
#DEFINE olFolderCalendar 9

cPK = "0000000001"  && pk value of item to add

LOCAL oNameSpace, oAppt1, oAppt2, oTask1, oTask2
IF VarType(oOutlook) <> "O"
   RELEASE oOutlook
   PUBLIC oOutlook
   oOutlook = CreateObject("Outlook.Application")
ENDIF

oNameSpace = oOutlook.GetNameSpace("MAPI")
oCal=oNameSpace.GetDefaultFolder(olFolderCalendar)

set step on

IF TYPE('oCal.Folders("ACME5")') = "O"
   *--- already defined, dont add
   loSubCal = oCal.folders("ACME5")
ELSE
   loSubCal = oCal.folders.Add("ACME5")
ENDIF
oCal=oNameSpace.GetDefaultFolder(olFolderCalendar).Folders("ACME5")

cFindStr = '[Location] = "' + cPK + '"'
oAppt1 = loSubCal.Items.Find( '&cFindStr.' )
IF TYPE('oAppt1') = "O" 
   lFound = IIF(ISNULL(oAppt1), .f. , .t. )
ENDIF
IF ! lFound
   *---
   *--- appointment gets created in default CAL folder; NOT in ACME5
   *---
   oAppt1 = oOutlook.CreateItem( olAppointmentItem )
ENDIF
WITH oAppt1
   .Start    = DTOT( DATE() + 7 )
   .End      = DTOT( DATE() + 8 )
   .AllDayEvent = .T.	
   .Location = cPK
   .Body     = "Pull wisdom teeth"
   .ReminderSet = .F.				
   .Subject  = "Doctor Appointment"
   .Save()
ENDWITH

RELEASE oOutlook
RETURN
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform