L
Linn Kubler
Hi,
I'm writing a little script to move records from one public calendar to
another. I'm having a problem with accuracy though. When it is finished
runnig the two folders have the same number of records but the destination
folder is obviously wrong. It has blank subjects and some subjects are
duplicated when there's no duplicates in the source.
I can't simply drag and drop them over cause the two folders have different
custom views with different user defined fields that need to be mapped.
What kinds of tips can anyone suggest that will ensure data is mapped
accurately?
Here's the basic code I'm using:
Set orgDeliveriesFolder =
myNamespace.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("Deliveries")
' Set the destination folder
Set newDeliveriesFolder =
myNamespace.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("Deliveries
- Test Do Not Use")
' Read first patient record
Set PatientList = orgDeliveriesFolder.Items()
Set PatientRecord = PatientList.GetFirst
Do While Not PatientRecord Is Nothing
' Create new record in destination
Set newPatientRecord = newDeliveriesFolder.Items.Add
' Populate new record with data
newPatientRecord.Subject = PatientRecord.Subject
' newPatientRecord.Location = PatientRecord.Location
' newPatientRecord.Start = PatientRecord.Start
' newPatientRecord.Body = PatientRecord.Body
' newPatientRecord.UserProperties.Find("Team").Value =
PatientRecord.UserProperties.Find("Teams").Value
' newPatientRecord.UserProperties.Find("Therapies").Value =
PatientRecord.UserProperties.Find("Therapies").Value
' newPatientRecord.UserProperties.Find("Delivery").Value =
PatientRecord.UserProperties.Find("Delivery").Value
newPatientRecord.Save
' Get next patient in source list
Set PatientRecord = PatientList.GetNext
Loop
Note that the subject field is the patient's name in the form of 'lastname,
firstname'. I commented out the other fields for debugging purposes.
This seems pretty straight forward so I don't get why the extra blank
records and records with numbers instead of names would end up in the
destination. I was wondering if there was some function that would return
the whole text of the subject field from the source folder but I can't think
of one.
Thanks in advance,
Linn
I'm writing a little script to move records from one public calendar to
another. I'm having a problem with accuracy though. When it is finished
runnig the two folders have the same number of records but the destination
folder is obviously wrong. It has blank subjects and some subjects are
duplicated when there's no duplicates in the source.
I can't simply drag and drop them over cause the two folders have different
custom views with different user defined fields that need to be mapped.
What kinds of tips can anyone suggest that will ensure data is mapped
accurately?
Here's the basic code I'm using:
Set orgDeliveriesFolder =
myNamespace.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("Deliveries")
' Set the destination folder
Set newDeliveriesFolder =
myNamespace.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("Deliveries
- Test Do Not Use")
' Read first patient record
Set PatientList = orgDeliveriesFolder.Items()
Set PatientRecord = PatientList.GetFirst
Do While Not PatientRecord Is Nothing
' Create new record in destination
Set newPatientRecord = newDeliveriesFolder.Items.Add
' Populate new record with data
newPatientRecord.Subject = PatientRecord.Subject
' newPatientRecord.Location = PatientRecord.Location
' newPatientRecord.Start = PatientRecord.Start
' newPatientRecord.Body = PatientRecord.Body
' newPatientRecord.UserProperties.Find("Team").Value =
PatientRecord.UserProperties.Find("Teams").Value
' newPatientRecord.UserProperties.Find("Therapies").Value =
PatientRecord.UserProperties.Find("Therapies").Value
' newPatientRecord.UserProperties.Find("Delivery").Value =
PatientRecord.UserProperties.Find("Delivery").Value
newPatientRecord.Save
' Get next patient in source list
Set PatientRecord = PatientList.GetNext
Loop
Note that the subject field is the patient's name in the form of 'lastname,
firstname'. I commented out the other fields for debugging purposes.
This seems pretty straight forward so I don't get why the extra blank
records and records with numbers instead of names would end up in the
destination. I was wondering if there was some function that would return
the whole text of the subject field from the source folder but I can't think
of one.
Thanks in advance,
Linn