K
k.mitz
I have been using the following code as part of a web application.
Set ol = CreateObject("Outlook.Application")
Set ns = ol.GetNamespace("MAPI")
Set fdr = ns.Folders("Public Folders").Folders("All Public
Folders").Folders("sg.com").Folders("JOB SCHEDULE")
Set itm = fdr.Items.Add()
Set psn = itm.UserProperties.Add("SGPersonnel",1, True)
psn.Value = "Jeff"
Set act = itm.UserProperties.Add("ActID",3, True)
act.Value = "123456789"
Set cust = itm.UserProperties.Add("CustID",3, True)
cust.Value = "AKL158478"
itm.Location = "New York, NY"
...
I would now like to be able to display each item matching the ActID
(which is a userproperty). I understand that to use the Restrict
method the field must exist in the folder.
Note: I created & published a form with the above mentioned fields and
checked "When posting to this folder use <<myForm>>" on the folder
properties page.
Set ol = CreateObject("Outlook.Application")
Set ns = ol.GetNamespace("MAPI")
Set fdr = ns.Folders("Public Folders").Folders("All Public
Folders").Folders("sg.com").Folders("JOB SCHEDULE")
Set res = fdr.Restrict("[ActID] = '123456789'")
MsgBox VarType(res) 'returns 9 - object
MsgBox res.Count ' returns 0
...
The Restrict method completes successfully, but never finds any
results. I can display the item using the Find method, but it takes a
long, long time.
My question is, does the above code create the fields in the folder, or
do I need to use "IPM.Appointment.SG" when I create the item using the
Add method?
Can I programatically change all the existing items so that they use
the proper form/folder combo so I can use the Restrict method?
Thanks.
Set ol = CreateObject("Outlook.Application")
Set ns = ol.GetNamespace("MAPI")
Set fdr = ns.Folders("Public Folders").Folders("All Public
Folders").Folders("sg.com").Folders("JOB SCHEDULE")
Set itm = fdr.Items.Add()
Set psn = itm.UserProperties.Add("SGPersonnel",1, True)
psn.Value = "Jeff"
Set act = itm.UserProperties.Add("ActID",3, True)
act.Value = "123456789"
Set cust = itm.UserProperties.Add("CustID",3, True)
cust.Value = "AKL158478"
itm.Location = "New York, NY"
...
I would now like to be able to display each item matching the ActID
(which is a userproperty). I understand that to use the Restrict
method the field must exist in the folder.
Note: I created & published a form with the above mentioned fields and
checked "When posting to this folder use <<myForm>>" on the folder
properties page.
Set ol = CreateObject("Outlook.Application")
Set ns = ol.GetNamespace("MAPI")
Set fdr = ns.Folders("Public Folders").Folders("All Public
Folders").Folders("sg.com").Folders("JOB SCHEDULE")
Set res = fdr.Restrict("[ActID] = '123456789'")
MsgBox VarType(res) 'returns 9 - object
MsgBox res.Count ' returns 0
...
The Restrict method completes successfully, but never finds any
results. I can display the item using the Find method, but it takes a
long, long time.
My question is, does the above code create the fields in the folder, or
do I need to use "IPM.Appointment.SG" when I create the item using the
Add method?
Can I programatically change all the existing items so that they use
the proper form/folder combo so I can use the Restrict method?
Thanks.