![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hello.
My toolbar marks Outlook objects (Contacts and Appointments) by setting my custom property UserProperties("id") as number. I need to find Contacts by this id property's value. I've got 2 examples of my code: 1) strFilter = "[MessageClass] 'IPM.Contacs' And [MessageClass] 'IPM.Contacu' And [id] '0'" If FindFolder.Items.Count 0 Then Set colObj = FindFolder.Items.Restrict(strFilter) For i = 1 To colObj.Count ... Next i End If 2) Set colContTest = FindFolder.Items.Restrict("[FirstName] = 'Fulvio' And [LastName] = 'Grignani'") If colContTest.Count 0 Then Set oContTest = colContTest.GetFirst id_t = oContTest.UserProperties("id") cid_t = oContTest.UserProperties("cid") End If Set colContTest = FindFolder.Items.Restrict("[id] = '" & id_t & "'") The first part of code is used to delete all objects which have IDs. It works OK. The second part of code is taken from the procedure which is used to find contact by id. It doesn't work correctly. It finds contact by name and after that gets it's id and cid correctly. But it can't find the same contatct by it's "id" property. The colContTest collection have 1 object after executing the first string, but is empty after the last string. I don't understand why almost the same functionality works in one procedure, but doesn't work in nother one. |
Ads |
#2
|
|||
|
|||
![]()
If those custom fields don't also exist in the folder then the Restrict
method should generate an error. Can you see them listed in the User Defined Fields in Folder section of the Field Chooser? -- Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "Sick Boy" wrote: Hello. My toolbar marks Outlook objects (Contacts and Appointments) by setting my custom property UserProperties("id") as number. I need to find Contacts by this id property's value. I've got 2 examples of my code: 1) strFilter = "[MessageClass] 'IPM.Contacs' And [MessageClass] 'IPM.Contacu' And [id] '0'" If FindFolder.Items.Count 0 Then Set colObj = FindFolder.Items.Restrict(strFilter) For i = 1 To colObj.Count ... Next i End If 2) Set colContTest = FindFolder.Items.Restrict("[FirstName] = 'Fulvio' And [LastName] = 'Grignani'") If colContTest.Count 0 Then Set oContTest = colContTest.GetFirst id_t = oContTest.UserProperties("id") cid_t = oContTest.UserProperties("cid") End If Set colContTest = FindFolder.Items.Restrict("[id] = '" & id_t & "'") The first part of code is used to delete all objects which have IDs. It works OK. The second part of code is taken from the procedure which is used to find contact by id. It doesn't work correctly. It finds contact by name and after that gets it's id and cid correctly. But it can't find the same contatct by it's "id" property. The colContTest collection have 1 object after executing the first string, but is empty after the last string. I don't understand why almost the same functionality works in one procedure, but doesn't work in nother one. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
delete property | Nikolas | Outlook - Using Forms | 13 | February 28th 07 07:53 PM |
Sent or Recieved Email Property | Irene | Outlook and VBA | 1 | February 2nd 07 08:31 PM |
MailItem To property and display name | Olivier Langlois | Outlook and VBA | 1 | September 11th 06 05:10 PM |
MessageClass Property of a Post | Geoff | Outlook and VBA | 13 | June 27th 06 08:49 AM |
Set MailItem.Sender Property | Joshua Ellul | Add-ins for Outlook | 2 | June 8th 06 06:30 PM |