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

Read contents of Note inserted in Outlook Contact Item Body



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 5th 06, 05:33 PM posted to microsoft.public.outlook.program_vba
JPL
external usenet poster
 
Posts: 7
Default Read contents of Note inserted in Outlook Contact Item Body

The following code successfully displays the first line of a Note attached to
a Contact Item:

Set objNotesColl = objContactItem.Attachments
If objNotesColl.Count 0 Then
MsgBox objNotesColl.Count & " items found for " & objContactItem.FullName
For Each objNote In objNotesColl
MsgBox objNote
Next objNote
End If

However, I wish to access the entire contents of the Note (objNote.Body),
not just the subject, and this does not work. Nor does reading the Subject
explicitly, i.e. "MsgBox objNote" works, but "MsgBox objNote.Subject" results
in a run-time error.

How can the entire contents of a Note be read?

JPL
Ads
  #2  
Old June 5th 06, 07:21 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Read contents of Note inserted in Outlook Contact Item Body

Your code displays the Attachment.DisplayName property, which happens to the
default Attachment object property.
DisplayName property for the embedded message attachments is the value of
the message's subject, which in case of the NoteItem is set to the very
first line of the body.

You cannot easily access embedded message attachments in the Outlook Object
Model (unless you save teh atatchment as an MSG file).
Such messages can be accessed using Extended MAPI (does not work with VB),
CDO 1.21 (Attachment.Source.Body) or Redemption
(Attachment.EmbeddedMsg.Body).

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

"JPL" wrote in message
news
The following code successfully displays the first line of a Note attached
to
a Contact Item:

Set objNotesColl = objContactItem.Attachments
If objNotesColl.Count 0 Then
MsgBox objNotesColl.Count & " items found for " &
objContactItem.FullName
For Each objNote In objNotesColl
MsgBox objNote
Next objNote
End If

However, I wish to access the entire contents of the Note (objNote.Body),
not just the subject, and this does not work. Nor does reading the
Subject
explicitly, i.e. "MsgBox objNote" works, but "MsgBox objNote.Subject"
results
in a run-time error.

How can the entire contents of a Note be read?

JPL



  #3  
Old June 5th 06, 07:38 PM posted to microsoft.public.outlook.program_vba
JPL
external usenet poster
 
Posts: 7
Default Read contents of Note inserted in Outlook Contact Item Body

Dmitry,

Thanks for your reply.

I appreciate that "MsgBox objNote" works because it is displaying the
default/displayname property, but am very surprised that the object model
does not allow access to the other properties of a note.

I also do not understand your explanation of message attachment processing.
Why should a Note be processed as a Message?

JPL

"Dmitry Streblechenko" wrote:

Your code displays the Attachment.DisplayName property, which happens to the
default Attachment object property.
DisplayName property for the embedded message attachments is the value of
the message's subject, which in case of the NoteItem is set to the very
first line of the body.

You cannot easily access embedded message attachments in the Outlook Object
Model (unless you save teh atatchment as an MSG file).
Such messages can be accessed using Extended MAPI (does not work with VB),
CDO 1.21 (Attachment.Source.Body) or Redemption
(Attachment.EmbeddedMsg.Body).

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

"JPL" wrote in message
news
The following code successfully displays the first line of a Note attached
to
a Contact Item:

Set objNotesColl = objContactItem.Attachments
If objNotesColl.Count 0 Then
MsgBox objNotesColl.Count & " items found for " &
objContactItem.FullName
For Each objNote In objNotesColl
MsgBox objNote
Next objNote
End If

However, I wish to access the entire contents of the Note (objNote.Body),
not just the subject, and this does not work. Nor does reading the
Subject
explicitly, i.e. "MsgBox objNote" works, but "MsgBox objNote.Subject"
results
in a run-time error.

How can the entire contents of a Note be read?

JPL




  #4  
Old June 5th 06, 08:16 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Read contents of Note inserted in Outlook Contact Item Body

Note *is* a message, at least on the Extended MAPI level. All item objects
exposed by Outlook (MailItem, ContactItem, NoteItem, AppointmentItem, etc)
are exposed on top of an Extended MAPI IMessage. The only difference between
these items is the value of the PR_MESSAGE_CLASS_PROPERTY.

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

"JPL" wrote in message
...
Dmitry,

Thanks for your reply.

I appreciate that "MsgBox objNote" works because it is displaying the
default/displayname property, but am very surprised that the object model
does not allow access to the other properties of a note.

I also do not understand your explanation of message attachment
processing.
Why should a Note be processed as a Message?

JPL

"Dmitry Streblechenko" wrote:

Your code displays the Attachment.DisplayName property, which happens to
the
default Attachment object property.
DisplayName property for the embedded message attachments is the value of
the message's subject, which in case of the NoteItem is set to the very
first line of the body.

You cannot easily access embedded message attachments in the Outlook
Object
Model (unless you save teh atatchment as an MSG file).
Such messages can be accessed using Extended MAPI (does not work with
VB),
CDO 1.21 (Attachment.Source.Body) or Redemption
(Attachment.EmbeddedMsg.Body).

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

"JPL" wrote in message
news
The following code successfully displays the first line of a Note
attached
to
a Contact Item:

Set objNotesColl = objContactItem.Attachments
If objNotesColl.Count 0 Then
MsgBox objNotesColl.Count & " items found for " &
objContactItem.FullName
For Each objNote In objNotesColl
MsgBox objNote
Next objNote
End If

However, I wish to access the entire contents of the Note
(objNote.Body),
not just the subject, and this does not work. Nor does reading the
Subject
explicitly, i.e. "MsgBox objNote" works, but "MsgBox objNote.Subject"
results
in a run-time error.

How can the entire contents of a Note be read?

JPL






  #5  
Old June 5th 06, 09:19 PM posted to microsoft.public.outlook.program_vba
JPL
external usenet poster
 
Posts: 7
Default Read contents of Note inserted in Outlook Contact Item Body

OK. Thanks.

I have used only standard MAPI and Outlook objects before and had not come
across Extended MAPI.

JPL

"Dmitry Streblechenko" wrote:

Note *is* a message, at least on the Extended MAPI level. All item objects
exposed by Outlook (MailItem, ContactItem, NoteItem, AppointmentItem, etc)
are exposed on top of an Extended MAPI IMessage. The only difference between
these items is the value of the PR_MESSAGE_CLASS_PROPERTY.

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

"JPL" wrote in message
...
Dmitry,

Thanks for your reply.

I appreciate that "MsgBox objNote" works because it is displaying the
default/displayname property, but am very surprised that the object model
does not allow access to the other properties of a note.

I also do not understand your explanation of message attachment
processing.
Why should a Note be processed as a Message?

JPL

"Dmitry Streblechenko" wrote:

Your code displays the Attachment.DisplayName property, which happens to
the
default Attachment object property.
DisplayName property for the embedded message attachments is the value of
the message's subject, which in case of the NoteItem is set to the very
first line of the body.

You cannot easily access embedded message attachments in the Outlook
Object
Model (unless you save teh atatchment as an MSG file).
Such messages can be accessed using Extended MAPI (does not work with
VB),
CDO 1.21 (Attachment.Source.Body) or Redemption
(Attachment.EmbeddedMsg.Body).

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

"JPL" wrote in message
news The following code successfully displays the first line of a Note
attached
to
a Contact Item:

Set objNotesColl = objContactItem.Attachments
If objNotesColl.Count 0 Then
MsgBox objNotesColl.Count & " items found for " &
objContactItem.FullName
For Each objNote In objNotesColl
MsgBox objNote
Next objNote
End If

However, I wish to access the entire contents of the Note
(objNote.Body),
not just the subject, and this does not work. Nor does reading the
Subject
explicitly, i.e. "MsgBox objNote" works, but "MsgBox objNote.Subject"
results
in a run-time error.

How can the entire contents of a Note be read?

JPL






 




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
Calendar is showing 1 unread item, but all items are read KNM101 Outlook - Calandaring 7 May 30th 06 04:40 PM
Pictures in mail item body Ivan Debono Outlook - General Queries 1 April 26th 06 11:52 PM
How do I modify Delete button to also mark item as read? [email protected] Outlook and VBA 1 April 24th 06 07:14 AM
Read body of MailItem ? Trey Shaffer Outlook and VBA 1 March 18th 06 08:56 PM
Read contents of web page Pierre Scerri Outlook and VBA 7 February 10th 06 08:35 AM


All times are GMT +1. The time now is 09:14 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.