Following are the properties of the NoteItem Object. Each property has been encapsulated in a function which can be called from your VBA programs. Each of the functions below includes sample VBA code. See The NoteItem Object for sample code to create NoteItems in several ways.
Application Property
Function NoteApplication(note As Outlook.NoteItem) As Outlook.Application Set NoteApplication = note.Application End Function Sub Test() Dim note As Outlook.NoteItem Dim noteApp As Outlook.Application Set note = Outlook.CreateItem(olNoteItem) Set noteApp = NoteApplication(note) End Sub
AutoResolvedWinner Property
Function NoteAutoResolvedWinner(note As Outlook.NoteItem) As Boolean NoteAutoResolvedWinner = ((note.Conflicts.Count > 0) And (note.AutoResolvedWinner)) End Function Sub Test() Dim note As Outlook.NoteItem Dim isWinner As Boolean Set note = Outlook.CreateItem(olNoteItem) isWinner = NoteAutoResolvedWinner(note) End Sub
How to tell if a Note is in conflict with another Note
Function IsNoteInConflict(note As Outlook.NoteItem) As Boolean IsNoteInConflict = ((note.Conflicts.Count > 0) Or (note.IsConflict)) End Function Sub Test() Dim note As Outlook.NoteItem Dim inConflict As Boolean Set note = Outlook.CreateItem(olNoteItem) inConflict = IsNoteInConflict(note) End Sub
Conflicts Property
Function GetNoteConflicts(note As Outlook.NoteItem) As Outlook.Conflicts Set GetNoteConflicts = note.Conflicts End Function Sub Test() Dim note As Outlook.NoteItem Dim cft As Outlook.Conflicts Set note = Outlook.CreateItem(olNoteItem) Set cft = GetNoteConflicts(note) End Sub
Body Property
Function NoteBody(note As Outlook.NoteItem, Optional bodyText As String, _
Optional append As Boolean = False) As String
' set or get Note body text
If Len(bodyText) > 0 Then
' set body text
If append Then
' add to existing body text
note.body = note.body & bodyText
Else
' replace with new body text
note.body = bodyText
End If
End If
' return body, whether updated or replaced or just checking value
NoteBody = note.body
End Function
Sub Test()
Dim note As Outlook.NoteItem
Dim noteText As String
Set note = Outlook.CreateItem(olNoteItem)
noteText = NoteBody(note)
End Sub
Categories Property
Function GetNoteCategories(note As Outlook.NoteItem) As String GetNoteCategories = note.Categories End Function Sub Test() Dim note As Outlook.NoteItem Dim noteCategories As String Set note = Outlook.CreateItem(olNoteItem) noteCategories = GetNoteCategories(note) End Sub
MessageClass Property
Function NoteMessageClass(note As Outlook.NoteItem, Optional msgClass As String) As String
' set or get Note message class
' what are the possible values?
If Len(msgClass) > 0 Then
note.MessageClass = msgClass
NoteMessageClass = msgClass
Else
' return value
NoteMessageClass = note.MessageClass
End If
End Function
Sub Test()
Dim note As Outlook.NoteItem
Dim noteMsgClass As String
Set note = Outlook.CreateItem(olNoteItem)
noteMsgClass = NoteMessageClass(note)
End Sub
Color Property
Function NoteColor(note As Outlook.NoteItem, Optional colorNote As Variant) As OlNoteColor
' colorNote should be one of the olNoteColor constants:
' olBlue, olGreen, olPink, olWhite, olYellow
If IsMissing(NoteColor) Then
' return value
NoteColor = note.Color
Else
' set value
note.Color = NoteColor
End If
NoteColor = note.Color
End Function
Sub Test()
Dim note As Outlook.NoteItem
Dim noteColor As OlNoteColor
Set note = Outlook.CreateItem(olNoteItem)
noteColor = NoteColor(note, olGreen)
End Sub
Height Property
Function NoteHeight(note As Outlook.NoteItem, Optional newheight As Long) As Long
' if new height provided, change height
If newheight > 0 Then
note.Height = newheight
End If
' return value, whether changed or not
NoteHeight = note.Height
End Function
Sub Test()
Dim note As Outlook.NoteItem
Dim ht As Long
Set note = Outlook.CreateItem(olNoteItem)
ht = NoteHeight(note)
End Sub
Left Property
Function NoteLeft(note As Outlook.NoteItem, Optional newLeft As Long) As Long
' if new Left provided, change Left
If newLeft > 0 Then
note.Left = newLeft
End If
' return value, whether changed or not
NoteLeft = note.Left
End Function
Sub Test()
Dim note As Outlook.NoteItem
Dim lft As Long
Set note = Outlook.CreateItem(olNoteItem)
lft = NoteLeft(note)
End Sub
Width Property
Function NoteWidth(note As Outlook.NoteItem, Optional newWidth As Long) As Long
' if new Width provided, change Width
If newWidth > 0 Then
note.Width = newWidth
End If
' return value, whether changed or not
NoteWidth = note.Width
End Function
Sub Test()
Dim note As Outlook.NoteItem
Dim wdth As Long
Set note = Outlook.CreateItem(olNoteItem)
wdth = NoteWidth(note)
End Sub
Top Property
Function NoteTop(note As Outlook.NoteItem, Optional newTop As Long) As Long
' if new Top provided, change Top
If newTop > 0 Then
note.Top = newTop
End If
' return value, whether changed or not
NoteTop = note.Top
End Function
Sub Test()
Dim note As Outlook.NoteItem
Dim tp As Long
Set note = Outlook.CreateItem(olNoteItem)
tp = NoteTop(note)
End Sub
CreationTime Property
Function GetNoteCreationTime(note As Outlook.NoteItem) As Date GetNoteCreationTime = note.CreationTime End Function Sub Test() Dim note As Outlook.NoteItem Dim noteCreationTime As Date Set note = Outlook.CreateItem(olNoteItem) noteCreationTime = GetNoteCreationTime(note) End Sub
DownloadState Property
Function GetNoteDownloadState(note As Outlook.NoteItem) As OlDownloadState GetNoteDownloadState = note.DownloadState End Function Sub Test() Dim note As Outlook.NoteItem Dim noteDLState As OlDownloadState Set note = Outlook.CreateItem(olNoteItem) noteDLState = GetNoteDownloadState(note) End Sub
EntryID Property
Function GetNoteEntryID(note As Outlook.NoteItem) As String GetNoteEntryID = note.EntryID End Function Sub Test() Dim note As Outlook.NoteItem Dim noteEntryID As String Set note = Outlook.CreateItem(olNoteItem) noteEntryID = GetNoteEntryID(note) End Sub
GetInspector Property
Function GetNoteInspector(note As Outlook.NoteItem) As Outlook.Inspector Set GetNoteInspector = note.GetInspector End Function Sub Test() Dim note As Outlook.NoteItem Dim noteInspector As Outlook.Inspector Set note = Outlook.CreateItem(olNoteItem) noteInspector = GetNoteInspector(note) End Sub
ItemProperties Property
Function GetNoteItemProperties(note As Outlook.NoteItem) As Outlook.ItemProperties Set GetNoteItemProperties = note.ItemProperties End Function Sub Test() Dim note As Outlook.NoteItem Dim noteProperties As Outlook.ItemProperties Set note = Outlook.CreateItem(olNoteItem) Set noteProperties = GetNoteItemProperties(note) End Sub
LastModificationTime Property
Function GetNoteLastModTime(note As Outlook.NoteItem) As Date GetNoteLastModTime = note.LastModificationTime End Function Sub Test() Dim note As Outlook.NoteItem Dim noteLastModTime As Date Set note = Outlook.CreateItem(olNoteItem) noteLastModTime = GetNoteLastModTime(note) End Sub
Links Property
Function GetNoteLinks(note As Outlook.NoteItem) As Outlook.Links Set GetNoteLinks = note.Links End Function Sub Test() Dim note As Outlook.NoteItem Dim noteLinks As Outlook.Links Set note = Outlook.CreateItem(olNoteItem) Set noteLinks = GetNoteLinks(note) End Sub
MarkForDownload Property
Function NoteMarkForDownload(note As Outlook.NoteItem, Optional remoteStatus As OlRemoteStatus) As OlRemoteStatus
' set or get remote status
Select Case remoteStatus
' if remoteStatus is specified, set it for the current NoteItem
Case olMarkedForCopy, olMarkedForDelete, olMarkedForDownload, _
olRemoteStatusNone, olUnMarked
note.MarkForDownload = remoteStatus
NoteMarkForDownload = remoteStatus
Case Else
' just return current status
NoteMarkForDownload = note.MarkForDownload
End Select
End Function
Sub Test()
Dim note As Outlook.NoteItem
Dim noteMFD As OlRemoteStatus
Set note = Outlook.CreateItem(olNoteItem)
noteMFD = NoteMarkForDownload(note)
End Sub
Parent Property
Function GetNoteParent(note As Outlook.NoteItem) As Object Set GetNoteParent = note.Parent End Function Sub Test() Dim note As Outlook.NoteItem Dim noteParent As Object Set note = Outlook.CreateItem(olNoteItem) Set noteParent = GetNoteParent(note) End Sub
Saved Property
Function GetNoteSaved(note As Outlook.NoteItem) As Boolean GetNoteSaved = note.Saved End Function Sub Test() Dim note As Outlook.NoteItem Dim isNoteSaved As Boolean Set note = Outlook.CreateItem(olNoteItem) isNoteSaved = GetNoteSaved(note) End Sub
Session Property
Function GetNoteSession(note As Outlook.NoteItem) As Outlook.NameSpace Set GetNoteSession = note.Session End Function Sub Test() Dim note As Outlook.NoteItem Dim noteNS As Outlook.NameSpace Set note = Outlook.CreateItem(olNoteItem) Set noteNS = GetNoteSession(note) End Sub
Size Property
Function GetNoteSize(note As Outlook.NoteItem) As Long GetNoteSize = note.Size End Function Sub Test() Dim note As Outlook.NoteItem Dim noteSize As Long Set note = Outlook.CreateItem(olNoteItem) noteSize = GetNoteSize(note) End Sub
Subject Property
Function NoteSubject(note As Outlook.NoteItem) As String NoteSubject = note.Subject End Function Sub Test() Dim note As Outlook.NoteItem Dim noteSubject As String Set note = Outlook.CreateItem(olNoteItem) noteSubject = NoteSubject(note) End Sub