Sub FileManuscript(Item As Outlook.MailItem)
Dim intPos1 As Integer, _
intPos2 As Integer, _
strCaseNumber As String, _
strEditor As String, _
objFolder As Object
Dim customProp1 As Outlook.UserProperty
Dim customProp2 As Outlook.UserProperty
Dim customProp3 As Outlook.UserProperty
intPos1 = InStr(1, Item.Subject, "TRVL-")
strCaseNumber = Mid(Item.Subject, intPos1 + 5, 4)
intPos1 = InStr(1, Item.Subject, "editor - ")
intPos1 = intPos1 + 9
intPos2 = InStr(1, Item.Subject, ")")
strEditor = Mid(Item.Subject, intPos1, intPos2 - intPos1)
Set objFolder = Outlook.Application.Session.GetDefaultFolder(olFolderInbox).Parent.Folders(strEditor)
Set objFolder = objFolder.Folders.Add(strCaseNumber)
Item.Move objFolder
Set customProp1 = objFolder.UserProperties.Add(custTitle, "test title")
Set customProp2 = objFolder.UserProperties.Add(custAuthor, "test author")
Set customProp3 = objFolder.UserProperties.Add(custMS, strCaseNumber)
Set objFolder = Nothing
End Sub
Sub FindProps()
Dim myApp As Outlook.Application
Dim myNms As Outlook.NameSpace
Dim myExplorer As Outlook.Explorer
Dim myFolder As Outlook.MAPIFolder
Dim objSelection As Selection
Dim objProperty As Outlook.UserProperty
Set myApp = CreateObject("Outlook.Application")
Set myNms = myApp.GetNamespace("MAPI")
Set myExplorer = myApp.ActiveExplorer
Set objSelection = myApp.myExplorer.Selection
Select Case objSelection.Count
Case 0 'NOTHING SeLECTED
strmsg = "No items were selected"
MsgBox strmsg, , "No selection"
Case Else
Set objProperty = objSelection.UserProperties.Find("custTitle")
If TypeName(objProperty) = "Nothing" Then
MsgBox "not found"
Else
MsgBox "Title is: " & objProperty.Value
End If
End Select
MsgBox "done"
End Sub
|