Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Does this work w/ your version of Windows/Outlook ?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00672419
Message ID:
00672450
Vues:
7
oops...

That was old code i posted. Try this if you would:
#DEFINE olAppointmentItem 1
#DEFINE olTaskItem 3
#DEFINE CR CHR(13)
#DEFINE olFolderCalendar 9

cPK = "0000000001"

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 )
   oAppt1 = loSubCal.Items.Add()
ELSE
   * dont fire the delete... expand on this later.
   * To delete the item, uncomment this line
   * oAppt1.Delete()
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
>Code should create a calendar folder called ACME5 under the default outlook "Calendar" folder and create an appointment that starts a week from today.
>
>Using VFP6, Windows 2000 professional, Outlook 2000 -- Created calendar and then appointment was added under the default calendar, not ACME5.
>
>Kevin
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform