A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Need help with MapiTable and EntryID/StoreID



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 20th 07, 07:29 AM posted to microsoft.public.outlook.program_vba
Peter Marchert
external usenet poster
 
Posts: 116
Default Need help with MapiTable and EntryID/StoreID

Thanks for the new version Dmitry.

With "urn:schemas:httpmail:subject" it works as I need it.

Peter

On 18 Aug., 07:52, "Dmitry Streblechenko" wrote:
Ah! I see what the problem is: ExecSQL was always using
PR_NORMALIZED_SUBJECT even if PR_SUBJECT was specified in the DASL format in
the WHERE clause.
Send a message to my e-mail address if you want an updated version.

Thanks!

Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Peter Marchert" wrote in message

...



Now I have two mails with "Test" and "FW: Test". If "Test" is selected
"urn:schemas:httpmail:subject" returns both items. But I only want the
subject which is complete the same.


I now give up. May be I spend to a later moment time with this problem.


Thank you all for your time you spended to this thread.


Peter


"Dmitry Streblechenko" schrieb im Newsbeitrag
...
This is to be expected: when it does not work (Subject = "FW: Test"),
PR_SUBJECT is "FW: Test" and PR_CONVERSATION_TOPIC = "Test". You script
specifies PR_CONVERSATION_TOPIC = "FW: Test", which no message will
match.
You need PR_SUBJECT = "FW: Test":


strSQL = "SELECT ""http://schemas.microsoft.com/mapi/proptag/
0x0037001E"" FROM Folder WHERE (""http://schemas.microsoft.com/mapi/
proptag/0037001E""='" & strSubject & "')"


Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Peter Marchert" wrote in message
roups.com...
Perhaps we are talking about different things :-)


My English is not the best so it could be a missunderstanding. I try
to describe my problem again:


I try to get all subjects of emails. For testing I have one email
selected and then run this code:


Sub MapiTableSQLTest()


Dim objItem As Outlook.MailItem
Dim Table
Dim Recordset
Dim strSQL As String
Dim strSubject As String


Set objItem = Outlook.ActiveExplorer.Selection(1)


strSubject = Replace(objItem.Subject, "'", "''")


Set Table = CreateObject("Redemption.MAPITable")


Table.Item = Outlook.ActiveExplorer.CurrentFolder.Items


strSQL = "SELECT ""http://schemas.microsoft.com/mapi/proptag/
0x0070001E"" FROM Folder WHERE (""http://schemas.microsoft.com/mapi/
proptag/0x0070001E""='" & strSubject & "')"


Set Recordset = Table.ExecSQL(strSQL)


While Not Recordset.EOF
Debug.Print Recordset.Fields(0).Value
Recordset.MoveNext
Wend


End Sub


If the subject of the selected email is "Test" the subject will be
returned. If the subject of the selected email is "FW: Test" the
subject will not be returned (both times I mean the subject will not
be printed by the debug.print command).


After Kens answer I booted an English Virtual PC with an English
Office 2003, but the result is the same. I used for this test the
original Redemption with version 4.4.0.714.


I have no idea why this will not work on my machines.


Peter


--
Infos, workshops & soft-
ware for your Outlook®:
www.outlook-stuff.com


On 17 Aug., 19:03, "Dmitry Streblechenko" wrote:
I am not sure I understand - since you are requesting an exact match on
PR_SUBJECT, you will only get exact matches, if an e-mail has a prefix,
it
won't match, and hence won't be returned.
If you request PR_CONVERSATION_TOPIC
(http://schemas.microsoft.com/mapi/proptag/0x0070001E), you will get
matches
on e-mails both with and without prefixes RE, FW, etc.


Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Peter Marchert" wrote in message


egroups.com...
Here is some code for testing:


Sub MapiTableSQLTest()


Dim objItem As Outlook.MailItem
Dim Table As Redemption.MAPITable
Dim Recordset
Dim strSQL As String


Set objItem = Outlook.ActiveExplorer.Selection(1)


Set Table = CreateObject("Redemption.MAPITable")
'Set Table = CreateObject("SafeOutlook.SecureMAPITable")


Table.Item = Outlook.ActiveExplorer.CurrentFolder.Items


strSQL = "SELECT ""urn:schemas:httpmail:subject"" FROM Folder
WHERE (""urn:schemas:httpmail:subject""='" & Replace(objItem.Subject,
"'", "''") & "')"


Set Recordset = Table.ExecSQL(strSQL)


While Not Recordset.EOF
Debug.Print Recordset.Fields(0).Value
Recordset.MoveNext
Wend


End Sub


If an email is marked with a prefix no records will be returnd.


Emails without prefix will be returned.


Peter


--
Infos, workshops & soft-
ware for your Outlook®:www.outlook-stuff.com


On 14 Aug., 20:21, Peter Marchert wrote:


Hmm, thank you Dmitry.


I tried all possibilities shown by Outlook Spy:


strSQL = "SELECT ""urn:schemas:httpmail:subject"" FROM Folder WHERE
(""urn:schemas:httpmail:subject""='" & Replace(objItem.Subject, "'",
"''") & "')"


strSQL = "SELECT ""urn:schemas:mailheader:subject"" FROM Folder WHERE
(""urn:schemas:mailheader:subject""='" & Replace(objItem.Subject, "'",
"''") & "')"


strSQL = "SELECT ""http://schemas.microsoft.com/mapi/proptag/
0x0037001E"" FROM Folder WHERE (""http://schemas.microsoft.com/mapi/
proptag/0x0037001E""='" & Replace(objItem.Subject, "'", "''") & "')"


But in all cases it seems to be returned only the subject without
prefixes. Can somebody confirm that this works on his machine?


Thanks for the hint with the time!


Peter


--
Infos, workshops & soft-
ware for your Outlook®:www.outlook-stuff.com


On 14 Aug., 18:59, "Dmitry Streblechenko" wrote:


For the Subject property restrictions, Redemption uses
PR_NORMALIZED_SUBJECT
(subject without any prefixes) - it is indexed by Exchange and is a
lot
faster than searching on PR_SUBJECT.
If you really need PR_SUBJECT, specify its in the DASL format (must
be
enclosed with double quotes) - either "urn:schemas:httpmail:subject"
orhttp://schemas.microsoft.com/mapi/proptag/0x0037001Ewoudldo.
Also keep in mind that you should never "=" with date/time
properties.
You
will never get a match because of the round-off errors.; always use
a
range
(value +- 1 second should work)


Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Peter Marchert" wrote in message


oups.com...


Here is the next problem :-)


If a subject includes a prefix like "", "FW:" or something
else, no
records will be returned. Here is my SQL-String:


strSQL = "SELECT LastModificationTime, EntryID, ReceivedTime,
Subject
FROM Folder WHERE (Subject='" & Replace(objItem.Subject, "'",
"''") &
"') AND (ReceivedTime='" & Format(objItem.ReceivedTime,
"yyyy-mm-dd
hh:nn:ss") & "')"


Hope for help


Peter


On 13 Aug., 20:51, Peter Marchert wrote:
Works fine! Thanks again!


Peter


On 13 Aug., 20:45, "Dmitry Streblechenko"
wrote:


Double the single quote :


Subject='Lands'' End'


note that '' above is two single quotes, not a single double
quote.


Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Peter Marchert" wrote in message


oups.com...


Need help again :-)


In the SQL-Statement I have sometimes characters which cannot
be
parsed by the ExcecSQL-Method, for example:


strSQL = "SELECT Email1Address, Subject from Folder
') and (Subject='Lands'
End')"


What can I do to get these subjects too? I tried "" instead
of '
but
this does not help.


Peter


On 13 Aug., 19:24, Peter Marchert wrote:
Now it works fine! Thank you, Dmitry.


Peter


On 13 Aug., 18:55, "Dmitry Streblechenko"

wrote:


Sorry, I forgot that piece: you need to move to the next
record.
At the
very
end of the while loop, add


Recordset.MoveNext


Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Peter Marchert" wrote in message


roups.com...


Thank you Dmitry for your answer.


On 12 Aug., 23:32, "Dmitry Streblechenko"

wrote:


...

Erfahren Sie mehr »- Zitierten Text ausblenden -

- Zitierten Text anzeigen -



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL filters with MAPITABLE DENNIS BROWN Outlook and VBA 1 July 21st 07 09:50 PM
showing contact by StoreID / EntryID from favourite folders Johannes Franke Outlook - Using Contacts 6 June 8th 06 09:07 PM
showing contact by StoreID / EntryID from favourite folders Johannes Franke Outlook - Using Contacts 0 June 8th 06 03:22 PM
Scope of StoreID and EntryID Scott Outlook and VBA 4 January 20th 06 06:35 PM
Redemption MAPITable Dmitry Streblechenko Add-ins for Outlook 1 January 12th 06 04:09 AM


All times are GMT +1. The time now is 05:16 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.