I'm writing a script that creates and updates an outlook note. Everything works fine except for one issue.
It creates and updates the note on my personal mailbox and I need it to create and maintain the note on a department mailbox that we all have access to(I have two accounts set up in my Outlook).
It is behaving this way despite the script being triggered by a rule on the department mailbox and being given mail items for the department mailbox. How do I tell VBS/Outlook which notes folder/account I want to use? I cannot find anything anywhere that outlines how to select which account the note will be created under.
I am using Outlook 2016.
Set olkFolder = Session.GetDefaultFolder(olFolderNotes)
Set olkNote = olkFolder.Items.Find("[Subject] = 'Sequential Number'")
If TypeName(olkNote) = "Nothing" Then
Set olkNote = Application.CreateItem(olNoteItem)
olkNote.Body = "Sequential Number" & vbCrLf & "NextValue=" & STARTING_VALUE + 1
GetNextNumber = STARTING_VALUE
Else
arrLines = Split(olkNote.Body, vbCrLf)
For Each varLine In arrLines
If Left(varLine, 10) = "NextValue=" Then
GetNextNumber = CInt(Mid(varLine, 11))
olkNote.Body = "Sequential Number" & vbCrLf & "NextValue=" & GetNextNumber + 1
End If
Next
End If