Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook Rule on Items Sent "on behalf of"

Status
Not open for further replies.

WANguy2k

MIS
Feb 25, 2002
363
US
I have someone who has given delegate to an admin, and wants to get an alert or an email whenever the delegate sends an email on behalf of her. I looked into setting up a rule on sent items, but I didn't see a way of checking for "on behalf of" in the sender's address.

Any other way this can be done?
 
on reading further this appears in the replies and is confirmed as working....worth a try
The easy way to do this is to go into bobs calendar, TOOLs > Macro > Visual Basic Editor
Expand Project 1 > microsoft Office Outlook object > THisOutlookSession

Paste in the following code. (replacing USERN with persons mailbox name).
Code:
Private SentEntryID As String
Private SentStoreID As String
Private WithEvents objSentItems As Items
Private MailItem As Outlook.MailItem

Public Sub Application_Startup()
‘Retrieve ID for accessing non-default sent folder
getStoreFolderID (“Mailbox – USERSN”)
Set objSentItems = Application.Session.GetDefaultFolder(olFolderSentMail).Items
End Sub

Function getStoreFolderID(StoreName)
‘Gets the Shared Account Sent Folder
Dim Store As Object
Dim StoreFolder As Object
Dim i As Integer
Set Store = Application.GetNamespace(“MAPI”).Folders
For Each StoreFolder In Store
If StoreFolder.Name = StoreName Then
For i = 1 To StoreFolder.Folders.Count
If StoreFolder.Folders(i).Name = “Sent Items” Then
SentEntryID = StoreFolder.Folders(i).EntryID
SentStoreID = StoreFolder.Folders(i).StoreID
Exit For
End If
Next
Exit For
End If
Next
Set Store = Nothing
Set StoreFolder = Nothing
End Function

Private Sub objSentItems_ItemAdd(ByVal Item As Object)
‘Fired when something is added to personal “Sent Mail” folder
If TypeOf Item Is Outlook.MailItem Then
With Item
Set MailItem = Application.GetNamespace(“mapi”).GetItemFromID(.EntryID, .Parent.StoreID)
End With
If MailItem.SentOnBehalfOfName = “USERN” Then
Set DestinationFolder = Application.Session.GetFolderFromID(SentEntryID, SentStoreID)
MailItem.Move (DestinationFolder)
End If
End If
Set MailItem = Nothing
End Sub

I used to have a handle on life... but it broke. Cpt. Red Bull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top