Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to find Outlook appointment and update/delete it
Message
 
À
18/06/2002 13:22:46
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00669711
Message ID:
00671996
Vues:
56
Getting closer but still having trouble creating the appointment item in the "subcalendar" folder. Am able to check for and create a subfolder of the "Calendar" folder. And the "FIND" is working (am storing a PK value into the appointment's LOCATION field so that i can search for it later). But have tried several different versions of the CREATEITEMS command, trying to get the new appointment created in the ACME5 subfolder, but no luck. Its always created in the default cal folder.

I need to have the command:
oAppt1 = oOutlook.CreateItem( olAppointmentItem )
create the item in the ACME5 subcal folder. Am using the following:
#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
>>How do u find an EXISTING outlook APPOINTMENT item and update/delete it? With outlook CONTACTS, there are several fields that can be populated with a PK value. You can then search for this PK value and update the contact if found or add new if not found. Cant find any appointment fields that can be used in similar manner. Cant search on the appointment's start/end and subject fields cuz they could have changed in the VFP table.
>
>Every item in Outlook has a unique id stored in the EntryID property. You can use it to find the item you're looking for.
>
>Use the GetItemFromId method to find the item with a given EntryID.
>
>As for deleting an item, get a reference to the item, then call its delete method.
>
>
>oOutlook=CreateObject("Outlook.Application")
>oNS = oOutlook.GetNameSpace("MAPI")
>oCalendar = oNS.GetDefaultFolder(9)
>oItems = oCalendar.Items
>oMyItem = oItems.GetItemFromId( cEntryID )
>* To change the item, set properties here, then:
>oMyItem.Save()
>
>* To delete the item:
>oMyItem.Delete()
>
>
>Tamar
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform