B
Ben Lawless
Hello,
I am trying to populate three user defined fields in my Inbox folder
with strings that I parse from an incoming email that meets a certain
criteria.
I am able to parse the three strings at the time the email comes in, but
I am not able to assign them to their respective columns in their Inbox
folder.
Here is my code so far:
Sub CustomMailMessageRule(Item As Outlook.MailItem)
Dim myOlApp As Outlook.Application
Dim strDueDate As String
Dim strPriority As String
Dim blnInitialResponse As Boolean
Dim strInitialResponse As String
Dim myUserProperty As Outlook.UserProperty
Dim myUserPropertyTwo As Outlook.UserProperty
Dim myUserPropertyThree As Outlook.UserProperty
On Error Resume Next
'Get Due Date from email body
strDueDate = ResponseMacro.ParseDueDate("Requested Completion
Date.+\s", Item.Body)
strDueDate = Trim(strDueDate)
If strDueDate = "" Then
strDueDate = "None"
End If
Set myUserProperty = Item.UserProperties.Add("Date Due", olText)
Set myUserProperty.Value = strDueDate
myUserProperty.AddToFolderFields
'Get Priority from email body
strPriority = ResponseMacro.ParsePriority("Priority.+\s", Item.Body)
strPriority = Trim(strPriority)
If strPriority = "" Then
strPriority = "N/A"
End If
Set myUserPropertyTwo = Item.UserProperties.Add("Priority Lvl",
olText)
Set myUserPropertyTwo.Value = strPriority
myUserPropertyTwo.AddToFolderFields
'Set Inital Response sent to True
blnInitalResponse = False
strInitialResponse = CStr(blnInitalResponse)
Set myUserPropertyThree = Item.UserProperties.Add("Initial Sent",
olText)
Set myUserPropertyThree.Value = strInitialResponse
myUserPropertyThree.AddToFolderFields
myOlApp.Close olSave
MsgBox "Running script" & " _ " & strDueDate & " _ " & strPriority &
" _ " & strInitialResponse
End Sub
The Msg Box is just used to verify that the strings are being captured
and that the values are correct. Any help would be appreciated.
Thanks!
*** Sent via Developersdex http://www.developersdex.com ***
I am trying to populate three user defined fields in my Inbox folder
with strings that I parse from an incoming email that meets a certain
criteria.
I am able to parse the three strings at the time the email comes in, but
I am not able to assign them to their respective columns in their Inbox
folder.
Here is my code so far:
Sub CustomMailMessageRule(Item As Outlook.MailItem)
Dim myOlApp As Outlook.Application
Dim strDueDate As String
Dim strPriority As String
Dim blnInitialResponse As Boolean
Dim strInitialResponse As String
Dim myUserProperty As Outlook.UserProperty
Dim myUserPropertyTwo As Outlook.UserProperty
Dim myUserPropertyThree As Outlook.UserProperty
On Error Resume Next
'Get Due Date from email body
strDueDate = ResponseMacro.ParseDueDate("Requested Completion
Date.+\s", Item.Body)
strDueDate = Trim(strDueDate)
If strDueDate = "" Then
strDueDate = "None"
End If
Set myUserProperty = Item.UserProperties.Add("Date Due", olText)
Set myUserProperty.Value = strDueDate
myUserProperty.AddToFolderFields
'Get Priority from email body
strPriority = ResponseMacro.ParsePriority("Priority.+\s", Item.Body)
strPriority = Trim(strPriority)
If strPriority = "" Then
strPriority = "N/A"
End If
Set myUserPropertyTwo = Item.UserProperties.Add("Priority Lvl",
olText)
Set myUserPropertyTwo.Value = strPriority
myUserPropertyTwo.AddToFolderFields
'Set Inital Response sent to True
blnInitalResponse = False
strInitialResponse = CStr(blnInitalResponse)
Set myUserPropertyThree = Item.UserProperties.Add("Initial Sent",
olText)
Set myUserPropertyThree.Value = strInitialResponse
myUserPropertyThree.AddToFolderFields
myOlApp.Close olSave
MsgBox "Running script" & " _ " & strDueDate & " _ " & strPriority &
" _ " & strInitialResponse
End Sub
The Msg Box is just used to verify that the strings are being captured
and that the values are correct. Any help would be appreciated.
Thanks!
*** Sent via Developersdex http://www.developersdex.com ***