![]() |
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
|
|||
|
|||
![]()
I'm trying to use the .Restrict method to select emails within the Inbox:
sSearch$ = "[From] = 'Jake Parlance'" Set fldFolder = CRM.O.AppNameSpace.GetDefaultFolder(olFolderInbox) Set objItemsCollection = fldFolder.Items.Restrict(sSearch$) This works just fine if the email in question has in its From field the name Jake Parlance. But if I only know Jake Parlance's email address then it would fail: sSearch$ = "[From] = '" I assume it fails because the email address is "resolved" to the person's actual name. I'd like to be able to search using only the email address without needing to know the person's name. Is there a way to do this? I tried: sSearch$ = "[E-mail] = '" This did not work because I assume "[E-mail]" is not a "keyword"? Is it possible to search using email only? Also, where does one find a list of all the "keywords", like "[From]"? Thanks! JW |
#2
|
|||
|
|||
![]()
Use the SenderEmailAddress property in your restriction.
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Jerry West" wrote in message ... I'm trying to use the .Restrict method to select emails within the Inbox: sSearch$ = "[From] = 'Jake Parlance'" Set fldFolder = CRM.O.AppNameSpace.GetDefaultFolder(olFolderInbox) Set objItemsCollection = fldFolder.Items.Restrict(sSearch$) This works just fine if the email in question has in its From field the name Jake Parlance. But if I only know Jake Parlance's email address then it would fail: sSearch$ = "[From] = '" I assume it fails because the email address is "resolved" to the person's actual name. I'd like to be able to search using only the email address without needing to know the person's name. Is there a way to do this? I tried: sSearch$ = "[E-mail] = '" This did not work because I assume "[E-mail]" is not a "keyword"? Is it possible to search using email only? Also, where does one find a list of all the "keywords", like "[From]"? Thanks! JW |
#3
|
|||
|
|||
![]()
Thank you for your answer. Where does one find a list of these "keywords"?
For, example SenderEmailAddress or From? Is there a list of these keywords anywhere? Is "To" a valid keyword? I am trying to select emails based on who the email was sent to from within the Sent Items folder: sSearch$ = "[To] = '" Set fldFolder = CRM.O.AppNameSpace.GetDefaultFolder(olFolderSentMa il) Set objItemsCollection = fldFolder.Items.Restrict(sSearch$) The objItemsCollection.Count property is always 0. So I'm wondering if "To" is a keyword? If not, what should I be using and where does one find these keywords? Thanks, JW "Dmitry Streblechenko" wrote in message ... Use the SenderEmailAddress property in your restriction. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Jerry West" wrote in message ... I'm trying to use the .Restrict method to select emails within the Inbox: sSearch$ = "[From] = 'Jake Parlance'" Set fldFolder = CRM.O.AppNameSpace.GetDefaultFolder(olFolderInbox) Set objItemsCollection = fldFolder.Items.Restrict(sSearch$) This works just fine if the email in question has in its From field the name Jake Parlance. But if I only know Jake Parlance's email address then it would fail: sSearch$ = "[From] = '" I assume it fails because the email address is "resolved" to the person's actual name. I'd like to be able to search using only the email address without needing to know the person's name. Is there a way to do this? I tried: sSearch$ = "[E-mail] = '" This did not work because I assume "[E-mail]" is not a "keyword"? Is it possible to search using email only? Also, where does one find a list of all the "keywords", like "[From]"? Thanks! JW |
#4
|
|||
|
|||
![]()
It is just an Outlook property name, as in MailItem.SenderEmailAddress. Have
you actually tried it? To property in most cases includes both names and addresses and corresponds to the PR_DISPLAY_TO MAPI property (look at messages with MFCMAPI or OutlookSpy), so your restriction won't match any messages. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Jerry West" wrote in message ... Thank you for your answer. Where does one find a list of these "keywords"? For, example SenderEmailAddress or From? Is there a list of these keywords anywhere? Is "To" a valid keyword? I am trying to select emails based on who the email was sent to from within the Sent Items folder: sSearch$ = "[To] = '" Set fldFolder = CRM.O.AppNameSpace.GetDefaultFolder(olFolderSentMa il) Set objItemsCollection = fldFolder.Items.Restrict(sSearch$) The objItemsCollection.Count property is always 0. So I'm wondering if "To" is a keyword? If not, what should I be using and where does one find these keywords? Thanks, JW "Dmitry Streblechenko" wrote in message ... Use the SenderEmailAddress property in your restriction. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Jerry West" wrote in message ... I'm trying to use the .Restrict method to select emails within the Inbox: sSearch$ = "[From] = 'Jake Parlance'" Set fldFolder = CRM.O.AppNameSpace.GetDefaultFolder(olFolderInbox) Set objItemsCollection = fldFolder.Items.Restrict(sSearch$) This works just fine if the email in question has in its From field the name Jake Parlance. But if I only know Jake Parlance's email address then it would fail: sSearch$ = "[From] = '" I assume it fails because the email address is "resolved" to the person's actual name. I'd like to be able to search using only the email address without needing to know the person's name. Is there a way to do this? I tried: sSearch$ = "[E-mail] = '" This did not work because I assume "[E-mail]" is not a "keyword"? Is it possible to search using email only? Also, where does one find a list of all the "keywords", like "[From]"? Thanks! JW |
#6
|
|||
|
|||
![]()
No, [To] won't work since you are not including the name (it may or rmay not
be there)- look at messages with OutlookSpy. most likely To (and PR_DISPLAY_TO MAPI) will be something like "Jerry West" or "Jerry West " Do use SenderEmailAddress. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Jerry West" wrote in message ... as in MailItem.SenderEmailAddress. Have you actually tried it? Yes, it worked great. To property in most cases includes both names and addresses So then the code I show should work, right? I checked the email and I see that the "To" field shows the email address versus the actual name: sSearch$ = "[To] = '" Set fldFolder = CRM.O.AppNameSpace.GetDefaultFolder(olFolderSentMa il) Set objItemsCollection = fldFolder.Items.Restrict(sSearch$) Is the above not valid for selecting an email address of within the Sent Items folder? If not, what is the proper way to do it? Can you show an example? I have tried the above on my system and it does not locate the email address in the Sent Items folder that I know is there. Thanks, JW "Dmitry Streblechenko" wrote in message ... It is just an Outlook property name, as in MailItem.SenderEmailAddress. Have you actually tried it? To property in most cases includes both names and addresses and corresponds to the PR_DISPLAY_TO MAPI property (look at messages with MFCMAPI or OutlookSpy), so your restriction won't match any messages. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Jerry West" wrote in message ... Thank you for your answer. Where does one find a list of these "keywords"? For, example SenderEmailAddress or From? Is there a list of these keywords anywhere? Is "To" a valid keyword? I am trying to select emails based on who the email was sent to from within the Sent Items folder: sSearch$ = "[To] = '" Set fldFolder = CRM.O.AppNameSpace.GetDefaultFolder(olFolderSentMa il) Set objItemsCollection = fldFolder.Items.Restrict(sSearch$) The objItemsCollection.Count property is always 0. So I'm wondering if "To" is a keyword? If not, what should I be using and where does one find these keywords? Thanks, JW "Dmitry Streblechenko" wrote in message ... Use the SenderEmailAddress property in your restriction. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Jerry West" wrote in message ... I'm trying to use the .Restrict method to select emails within the Inbox: sSearch$ = "[From] = 'Jake Parlance'" Set fldFolder = CRM.O.AppNameSpace.GetDefaultFolder(olFolderInbox) Set objItemsCollection = fldFolder.Items.Restrict(sSearch$) This works just fine if the email in question has in its From field the name Jake Parlance. But if I only know Jake Parlance's email address then it would fail: sSearch$ = "[From] = '" I assume it fails because the email address is "resolved" to the person's actual name. I'd like to be able to search using only the email address without needing to know the person's name. Is there a way to do this? I tried: sSearch$ = "[E-mail] = '" This did not work because I assume "[E-mail]" is not a "keyword"? Is it possible to search using email only? Also, where does one find a list of all the "keywords", like "[From]"? Thanks! JW |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Is Restrict Dynamic | MON205 | Add-ins for Outlook | 2 | April 4th 07 04:34 PM |
Restrict method problem | Mike Epp | Outlook and VBA | 2 | April 7th 06 07:03 PM |
Restrict Method DNW | emanson | Outlook and VBA | 14 | March 28th 06 05:47 AM |
2 emails in one profile, how to select witch to use | Roger Payne | Outlook - Installation | 2 | February 26th 06 12:17 PM |
Restrict | jim | Add-ins for Outlook | 2 | January 13th 06 08:14 PM |