Hi
I am using the following code to search for an email message with id myID;
Dim SentFld As Outlook.MAPIFolder
Dim Email As Outlook.MailItem
Dim I As Integer
OutlookApp = New Outlook.Application
SentFld =
OutlookApp.Session.GetDefaultFolder(Outlook.OlDefa ultFolders.olFolderSentMai
l)
iCount = SentFld.Items.Count
Email = CType(SentFld.Items.Item(1), Outlook.MailItem)
Email.UserProperties.Add("EmailID", Outlook.OlUserPropertyType.olText, True)
Email = SentFld.Items.Find("[EmailID]=""" & myID & """")
The problem is that the find is very slow. Is there a faster way to search
for emails with specific user defined ids?
Thanks
Regards 9 7331
Hi John,
I remember me that I had the same problem a very long time ago.
But then I thougth the problem was the time to load the folder over the
network and not the search, I had no solution, but can it be this is the
same problem?
I know it does not help, but I ask this to get it easier for others to help
you, and then maybe I know the solution too then.
Cor I am using the following code to search for an email message with id myID;
Dim SentFld As Outlook.MAPIFolder Dim Email As Outlook.MailItem Dim I As Integer OutlookApp = New Outlook.Application
SentFld =
OutlookApp.Session.GetDefaultFolder(Outlook.OlDefa ultFolders.olFolderSentMai l) iCount = SentFld.Items.Count Email = CType(SentFld.Items.Item(1), Outlook.MailItem) Email.UserProperties.Add("EmailID", Outlook.OlUserPropertyType.olText,
True) Email = SentFld.Items.Find("[EmailID]=""" & myID & """")
The problem is that the find is very slow. Is there a faster way to search for emails with specific user defined ids?
You could try the restrict method rather than the find method. Also,
Outlook has unique ID's on every item called the EntryID (or ID on the
mailitem). You may just want to store and use that ID which will be much
faster to find using the built-in methods for finding via ID.
Tom
--
Looking for a good book on programming Exchange, Outlook, ADSI and
SharePoint? Check out http://www.microsoft.com/MSPress/books/5517.asp
This posting is provided "AS IS" with no warranties, and confers no rights.
"John" <jo**@nospam.infovis.co.uk> wrote in message
news:#m**************@TK2MSFTNGP12.phx.gbl... Hi
I am using the following code to search for an email message with id myID;
Dim SentFld As Outlook.MAPIFolder Dim Email As Outlook.MailItem Dim I As Integer OutlookApp = New Outlook.Application
SentFld =
OutlookApp.Session.GetDefaultFolder(Outlook.OlDefa ultFolders.olFolderSentMai l) iCount = SentFld.Items.Count Email = CType(SentFld.Items.Item(1), Outlook.MailItem) Email.UserProperties.Add("EmailID", Outlook.OlUserPropertyType.olText,
True) Email = SentFld.Items.Find("[EmailID]=""" & myID & """")
The problem is that the find is very slow. Is there a faster way to search for emails with specific user defined ids?
Thanks
Regards
Hi
Can I get an example of how to access the entryid for a new mail item? I
presume it can be search using; Email = SentFld.Items.Find("[EntryID]=""" &
myEntryID & """")?
Thanks
Regards
"Tom Rizzo [MSFT]" <th*****@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... You could try the restrict method rather than the find method. Also, Outlook has unique ID's on every item called the EntryID (or ID on the mailitem). You may just want to store and use that ID which will be much faster to find using the built-in methods for finding via ID.
Tom
-- Looking for a good book on programming Exchange, Outlook, ADSI and SharePoint? Check out http://www.microsoft.com/MSPress/books/5517.asp
This posting is provided "AS IS" with no warranties, and confers no
rights.
"John" <jo**@nospam.infovis.co.uk> wrote in message news:#m**************@TK2MSFTNGP12.phx.gbl... Hi
I am using the following code to search for an email message with id
myID; Dim SentFld As Outlook.MAPIFolder Dim Email As Outlook.MailItem Dim I As Integer OutlookApp = New Outlook.Application
SentFld =
OutlookApp.Session.GetDefaultFolder(Outlook.OlDefa ultFolders.olFolderSentMai l) iCount = SentFld.Items.Count Email = CType(SentFld.Items.Item(1), Outlook.MailItem) Email.UserProperties.Add("EmailID", Outlook.OlUserPropertyType.olText, True) Email = SentFld.Items.Find("[EmailID]=""" & myID & """")
The problem is that the find is very slow. Is there a faster way to
search for emails with specific user defined ids?
Thanks
Regards
Keep in mind that you can kill your Exchange server if you are using
Restrict rather than Find/FindNext - Exchange caches restrictions for about
1 week by default and updates the restriction results everytime any message
in the folder changes.
Dmitry Streblechenko (MVP) http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Tom Rizzo [MSFT]" <th*****@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... You could try the restrict method rather than the find method. Also, Outlook has unique ID's on every item called the EntryID (or ID on the mailitem). You may just want to store and use that ID which will be much faster to find using the built-in methods for finding via ID.
Tom
-- Looking for a good book on programming Exchange, Outlook, ADSI and SharePoint? Check out http://www.microsoft.com/MSPress/books/5517.asp
This posting is provided "AS IS" with no warranties, and confers no
rights.
"John" <jo**@nospam.infovis.co.uk> wrote in message news:#m**************@TK2MSFTNGP12.phx.gbl... Hi
I am using the following code to search for an email message with id
myID; Dim SentFld As Outlook.MAPIFolder Dim Email As Outlook.MailItem Dim I As Integer OutlookApp = New Outlook.Application
SentFld =
OutlookApp.Session.GetDefaultFolder(Outlook.OlDefa ultFolders.olFolderSentMai l) iCount = SentFld.Items.Count Email = CType(SentFld.Items.Item(1), Outlook.MailItem) Email.UserProperties.Add("EmailID", Outlook.OlUserPropertyType.olText, True) Email = SentFld.Items.Find("[EmailID]=""" & myID & """")
The problem is that the find is very slow. Is there a faster way to
search for emails with specific user defined ids?
Thanks
Regards
If you already know the entry id, you can simply use
Namespace.GetItemFromID() to open it.
Dmitry Streblechenko (MVP) http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"John" <jo**@nospam.infovis.co.uk> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl... Hi
Can I get an example of how to access the entryid for a new mail item? I presume it can be search using; Email = SentFld.Items.Find("[EntryID]="""
& myEntryID & """")?
Thanks
Regards
"Tom Rizzo [MSFT]" <th*****@microsoft.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... You could try the restrict method rather than the find method. Also, Outlook has unique ID's on every item called the EntryID (or ID on the mailitem). You may just want to store and use that ID which will be
much faster to find using the built-in methods for finding via ID.
Tom
-- Looking for a good book on programming Exchange, Outlook, ADSI and SharePoint? Check out http://www.microsoft.com/MSPress/books/5517.asp
This posting is provided "AS IS" with no warranties, and confers no rights.
"John" <jo**@nospam.infovis.co.uk> wrote in message news:#m**************@TK2MSFTNGP12.phx.gbl... Hi
I am using the following code to search for an email message with id
myID; Dim SentFld As Outlook.MAPIFolder Dim Email As Outlook.MailItem Dim I As Integer OutlookApp = New Outlook.Application
SentFld =
OutlookApp.Session.GetDefaultFolder(Outlook.OlDefa ultFolders.olFolderSentMai l) iCount = SentFld.Items.Count Email = CType(SentFld.Items.Item(1), Outlook.MailItem) Email.UserProperties.Add("EmailID", Outlook.OlUserPropertyType.olText, True) Email = SentFld.Items.Find("[EmailID]=""" & myID & """")
The problem is that the find is very slow. Is there a faster way to search for emails with specific user defined ids?
Thanks
Regards
Hi Dmitry
Anywhere I can get more information on this?
Thanks
Regards
"Dmitry Streblechenko" <dm****@dimastr.com> wrote in message
news:uu**************@TK2MSFTNGP11.phx.gbl... If you already know the entry id, you can simply use Namespace.GetItemFromID() to open it.
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool
"John" <jo**@nospam.infovis.co.uk> wrote in message news:%2***************@TK2MSFTNGP11.phx.gbl... Hi
Can I get an example of how to access the entryid for a new mail item? I presume it can be search using; Email =
SentFld.Items.Find("[EntryID]=""" & myEntryID & """")?
Thanks
Regards
"Tom Rizzo [MSFT]" <th*****@microsoft.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... You could try the restrict method rather than the find method. Also, Outlook has unique ID's on every item called the EntryID (or ID on the mailitem). You may just want to store and use that ID which will be much faster to find using the built-in methods for finding via ID.
Tom
-- Looking for a good book on programming Exchange, Outlook, ADSI and SharePoint? Check out http://www.microsoft.com/MSPress/books/5517.asp
This posting is provided "AS IS" with no warranties, and confers no rights.
"John" <jo**@nospam.infovis.co.uk> wrote in message news:#m**************@TK2MSFTNGP12.phx.gbl... > Hi > > I am using the following code to search for an email message with id
myID; > > Dim SentFld As Outlook.MAPIFolder > Dim Email As Outlook.MailItem > Dim I As Integer > OutlookApp = New Outlook.Application > > SentFld = >
OutlookApp.Session.GetDefaultFolder(Outlook.OlDefa ultFolders.olFolderSentMai > l) > iCount = SentFld.Items.Count > Email = CType(SentFld.Items.Item(1), Outlook.MailItem) > Email.UserProperties.Add("EmailID",
Outlook.OlUserPropertyType.olText, True) > Email = SentFld.Items.Find("[EmailID]=""" & myID & """") > > The problem is that the find is very slow. Is there a faster way to search > for emails with specific user defined ids? > > Thanks > > Regards > >
Outlook VBA help file:
GetItemFromID Method
See Also Applies To Example Specifics
Returns a Microsoft Outlook item identified by the specified entry ID (if
valid). This method is used for ease of transition between MAPI and
OLE/Messaging applications and Outlook.
expression.GetItemFromID(EntryIDItem, EntryIDStore)
expression Required. An expression that returns a NameSpace object.
EntryIDItem Required String. The EntryID of the item.
EntryIDStore Optional Variant. The StoreID for the folder.
Remarks
EntryIDStore usually must be provided when retrieving an item based on its
MAPI IDs.
Dmitry Streblechenko (MVP) http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"John" <jo**@nospam.infovis.co.uk> wrote in message
news:ur**************@TK2MSFTNGP12.phx.gbl... Hi Dmitry
Anywhere I can get more information on this?
Thanks
Regards
"Dmitry Streblechenko" <dm****@dimastr.com> wrote in message news:uu**************@TK2MSFTNGP11.phx.gbl... If you already know the entry id, you can simply use Namespace.GetItemFromID() to open it.
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool
"John" <jo**@nospam.infovis.co.uk> wrote in message news:%2***************@TK2MSFTNGP11.phx.gbl... Hi
Can I get an example of how to access the entryid for a new mail item?
I presume it can be search using; Email = SentFld.Items.Find("[EntryID]=""" & myEntryID & """")?
Thanks
Regards
"Tom Rizzo [MSFT]" <th*****@microsoft.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... > You could try the restrict method rather than the find method.
Also, > Outlook has unique ID's on every item called the EntryID (or ID on
the > mailitem). You may just want to store and use that ID which will be much > faster to find using the built-in methods for finding via ID. > > Tom > > -- > Looking for a good book on programming Exchange, Outlook, ADSI and > SharePoint? Check out
http://www.microsoft.com/MSPress/books/5517.asp > > This posting is provided "AS IS" with no warranties, and confers no rights. > > > > "John" <jo**@nospam.infovis.co.uk> wrote in message > news:#m**************@TK2MSFTNGP12.phx.gbl... > > Hi > > > > I am using the following code to search for an email message with
id myID; > > > > Dim SentFld As Outlook.MAPIFolder > > Dim Email As Outlook.MailItem > > Dim I As Integer > > OutlookApp = New Outlook.Application > > > > SentFld = > > >
OutlookApp.Session.GetDefaultFolder(Outlook.OlDefa ultFolders.olFolderSentMai > > l) > > iCount = SentFld.Items.Count > > Email = CType(SentFld.Items.Item(1), Outlook.MailItem) > > Email.UserProperties.Add("EmailID", Outlook.OlUserPropertyType.olText, > True) > > Email = SentFld.Items.Find("[EmailID]=""" & myID & """") > > > > The problem is that the find is very slow. Is there a faster way
to search > > for emails with specific user defined ids? > > > > Thanks > > > > Regards > > > > > >
Thanks. Now what remains is how to know the entryid of a mailitem when it is
saved/sent, so it can be referenced later.
Thanks
Regards
"Dmitry Streblechenko" <dm****@dimastr.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... Outlook VBA help file:
GetItemFromID Method
See Also Applies To Example Specifics Returns a Microsoft Outlook item identified by the specified entry ID (if valid). This method is used for ease of transition between MAPI and OLE/Messaging applications and Outlook.
expression.GetItemFromID(EntryIDItem, EntryIDStore)
expression Required. An expression that returns a NameSpace object.
EntryIDItem Required String. The EntryID of the item.
EntryIDStore Optional Variant. The StoreID for the folder.
Remarks EntryIDStore usually must be provided when retrieving an item based on its MAPI IDs.
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool
"John" <jo**@nospam.infovis.co.uk> wrote in message news:ur**************@TK2MSFTNGP12.phx.gbl... Hi Dmitry
Anywhere I can get more information on this?
Thanks
Regards
"Dmitry Streblechenko" <dm****@dimastr.com> wrote in message news:uu**************@TK2MSFTNGP11.phx.gbl... If you already know the entry id, you can simply use Namespace.GetItemFromID() to open it.
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool
"John" <jo**@nospam.infovis.co.uk> wrote in message news:%2***************@TK2MSFTNGP11.phx.gbl... > Hi > > Can I get an example of how to access the entryid for a new mail
item? I > presume it can be search using; Email = SentFld.Items.Find("[EntryID]=""" & > myEntryID & """")? > > Thanks > > Regards > > > "Tom Rizzo [MSFT]" <th*****@microsoft.com> wrote in message > news:%2****************@TK2MSFTNGP12.phx.gbl... > > You could try the restrict method rather than the find method. Also, > > Outlook has unique ID's on every item called the EntryID (or ID on the > > mailitem). You may just want to store and use that ID which will
be much > > faster to find using the built-in methods for finding via ID. > > > > Tom > > > > -- > > Looking for a good book on programming Exchange, Outlook, ADSI and > > SharePoint? Check out
http://www.microsoft.com/MSPress/books/5517.asp > > > > This posting is provided "AS IS" with no warranties, and confers
no > rights. > > > > > > > > "John" <jo**@nospam.infovis.co.uk> wrote in message > > news:#m**************@TK2MSFTNGP12.phx.gbl... > > > Hi > > > > > > I am using the following code to search for an email message
with id > myID; > > > > > > Dim SentFld As Outlook.MAPIFolder > > > Dim Email As Outlook.MailItem > > > Dim I As Integer > > > OutlookApp = New Outlook.Application > > > > > > SentFld = > > > > > >
OutlookApp.Session.GetDefaultFolder(Outlook.OlDefa ultFolders.olFolderSentMai > > > l) > > > iCount = SentFld.Items.Count > > > Email = CType(SentFld.Items.Item(1), Outlook.MailItem) > > > Email.UserProperties.Add("EmailID", Outlook.OlUserPropertyType.olText, > > True) > > > Email = SentFld.Items.Find("[EmailID]=""" & myID & """") > > > > > > The problem is that the find is very slow. Is there a faster way to > search > > > for emails with specific user defined ids? > > > > > > Thanks > > > > > > Regards > > > > > > > > > > > >
When an item is sent, its entry id changes when it is moved to the Sent
Items folder. Use MAPIFolder.Items.ItemAdd event (where MAPIFolder points to
Sent Items folder) to save the entry id of the item.
Dmitry Streblechenko (MVP) http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"John" <jo**@nospam.infovis.co.uk> wrote in message
news:eR**************@TK2MSFTNGP09.phx.gbl... Thanks. Now what remains is how to know the entryid of a mailitem when it
is saved/sent, so it can be referenced later.
Thanks
Regards
"Dmitry Streblechenko" <dm****@dimastr.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... Outlook VBA help file:
GetItemFromID Method
See Also Applies To Example Specifics Returns a Microsoft Outlook item identified by the specified entry ID
(if valid). This method is used for ease of transition between MAPI and OLE/Messaging applications and Outlook.
expression.GetItemFromID(EntryIDItem, EntryIDStore)
expression Required. An expression that returns a NameSpace object.
EntryIDItem Required String. The EntryID of the item.
EntryIDStore Optional Variant. The StoreID for the folder.
Remarks EntryIDStore usually must be provided when retrieving an item based on
its MAPI IDs.
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool
"John" <jo**@nospam.infovis.co.uk> wrote in message news:ur**************@TK2MSFTNGP12.phx.gbl... Hi Dmitry
Anywhere I can get more information on this?
Thanks
Regards
"Dmitry Streblechenko" <dm****@dimastr.com> wrote in message news:uu**************@TK2MSFTNGP11.phx.gbl... > If you already know the entry id, you can simply use > Namespace.GetItemFromID() to open it. > > Dmitry Streblechenko (MVP) > http://www.dimastr.com/ > OutlookSpy - Outlook, CDO > and MAPI Developer Tool > > > "John" <jo**@nospam.infovis.co.uk> wrote in message > news:%2***************@TK2MSFTNGP11.phx.gbl... > > Hi > > > > Can I get an example of how to access the entryid for a new mail item? I > > presume it can be search using; Email = SentFld.Items.Find("[EntryID]=""" > & > > myEntryID & """")? > > > > Thanks > > > > Regards > > > > > > "Tom Rizzo [MSFT]" <th*****@microsoft.com> wrote in message > > news:%2****************@TK2MSFTNGP12.phx.gbl... > > > You could try the restrict method rather than the find method. Also, > > > Outlook has unique ID's on every item called the EntryID (or ID
on the > > > mailitem). You may just want to store and use that ID which
will be > much > > > faster to find using the built-in methods for finding via ID. > > > > > > Tom > > > > > > -- > > > Looking for a good book on programming Exchange, Outlook, ADSI
and > > > SharePoint? Check out http://www.microsoft.com/MSPress/books/5517.asp > > > > > > This posting is provided "AS IS" with no warranties, and confers no > > rights. > > > > > > > > > > > > "John" <jo**@nospam.infovis.co.uk> wrote in message > > > news:#m**************@TK2MSFTNGP12.phx.gbl... > > > > Hi > > > > > > > > I am using the following code to search for an email message with id > > myID; > > > > > > > > Dim SentFld As Outlook.MAPIFolder > > > > Dim Email As Outlook.MailItem > > > > Dim I As Integer > > > > OutlookApp = New Outlook.Application > > > > > > > > SentFld = > > > > > > > > > >
OutlookApp.Session.GetDefaultFolder(Outlook.OlDefa ultFolders.olFolderSentMai > > > > l) > > > > iCount = SentFld.Items.Count > > > > Email = CType(SentFld.Items.Item(1), Outlook.MailItem) > > > > Email.UserProperties.Add("EmailID", Outlook.OlUserPropertyType.olText, > > > True) > > > > Email = SentFld.Items.Find("[EmailID]=""" & myID & """") > > > > > > > > The problem is that the find is very slow. Is there a faster
way to > > search > > > > for emails with specific user defined ids? > > > > > > > > Thanks > > > > > > > > Regards > > > > > > > > > > > > > > > > > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: George McCullen |
last post by:
I have an Outlook 2003 using Exchange Server 2003 Public Contacts Folder containing 20,000 Contacts. I am writing a VB .Net 2003 program that loops through all the contacts in a "for each oCt in...
|
by: Li Pang |
last post by:
Hi,
I wrote the following codes to read messages. They work fine for Outlook
2002 but fails for 2003. My felling it may be a bug of Outlook 2003. Anybody
has experience on that? Thanks in...
|
by: ratnakarp |
last post by:
Is there any way i can improve on this code? If i run this application
by giving the detials of the start date and end date in the range of
15 days, it's taking 3 mins. I'm looking for a code...
|
by: Tom Becker |
last post by:
Is there a way, from Access, to programmatically click the Send and
Receive button in Outlook?
|
by: Arno R |
last post by:
Hi all,
I need to get at specific (shared) agenda-data from MS outlook 2003.
I need every day to get the scheduled 'appointments' for some rooms to Access.
In Access I will show the...
|
by: PhilD |
last post by:
My C#.NET console app checks a public folder every 24 hours for incoming emails.
For each unread email in the folder, it copies any attachments to the network, then loads the contents of these files...
|
by: beeswax |
last post by:
Hi,
Does anyone knows how to read e-mails from a specific folders in
outlook?
I only found out how to read the mails from the inbox folder and how
to list all available folder.
I just don't...
|
by: jazeelkm |
last post by:
Hi ,
I am developing a windows application using C#. In that I want to display all the outlook profiles in a listbox and on selecting one, The folder structure should be displayed on a treeview...
|
by: infomage27 |
last post by:
I have tried scripting this with rules and VBA, now trying with C# but still failing. (code is exploratory, so please excuse the terribleness)
maybe someone here will show me the error of my...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |