Public Folder Script Event

Public Folder Script Event

Post by msnews.microsoft.co » Fri, 26 Mar 1999 04:00:00



I am pretty new to the whole scripting of events in Exchange and am trying
to learn my way around.

One thing I would like to do is when a new message (class type IPM.Post) is
received it will forward the message to a DL as class type IPM.Note and then
delete the original IPM.Post message.

Can anyone point me to a sample script that might do something similar or
provide any input.

Regards,
Brian

 
 
 

Public Folder Script Event

Post by Rick Spiewa » Thu, 08 Apr 1999 04:00:00


Here's a similar script which sends a message, you can start with this and
change it:
<SCRIPT RunAt=Server Language=VBScript>

'---------------------------------------------------------------------------
---
'FILE DESCRIPTION: Exchange Server Event Script
'---------------------------------------------------------------------------
---

Option Explicit

'---------------------------------------------------------------------------
---
' Global Variables
'---------------------------------------------------------------------------
---

'---------------------------------------------------------------------------
---
' Event Handlers
'---------------------------------------------------------------------------
---

' DESCRIPTION: This event is fired when a new message is added to the folder
Public Sub Folder_OnMessageCreated
 dim objSession, objAddrList, objAddr, objMessage, objSender, objMessageOut,
objRecip
 set objSession = EventDetails.Session
 ' Get the message which was created
 set objMessage = objSession.GetMessage(EventDetails.MessageID,Null)
 set objSender = objMessage.Sender
 Script.Response = "Recipient = " & objSender.Name    'Use your DL name here
instead
 set objMessageOut = objSession.Outbox.Messages.add(,,"IPM.Note")
 set objRecip = objMessageOut.Recipients.Add(,,,objSender.ID) 'Use your DL
name here instead, and resolve it
objMessageOut.Subject = objMessage.Subject
 objMessageOut.Text = "Automatic Message from the Simple Script"
 objMessageOut.Update
 objMessageOut.Send
End Sub

' DESCRIPTION: This event is fired when a message in the folder is changed
Public Sub Message_OnChange
End Sub

' DESCRIPTION: This event is fired when a message is deleted from the folder
Public Sub Folder_OnMessageDeleted
End Sub

' DESCRIPTION: This event is fired when the timer on the folder expires
Public Sub Folder_OnTimer
End Sub

</SCRIPT>

Quote:> I am pretty new to the whole scripting of events in Exchange and am trying
> to learn my way around.

> One thing I would like to do is when a new message (class type IPM.Post)
is
> received it will forward the message to a DL as class type IPM.Note and
then
> delete the original IPM.Post message.

> Can anyone point me to a sample script that might do something similar or
> provide any input.

> Regards,
> Brian


 
 
 

1. Determining Public Folder Tree from Event Script

I was trying to figure out how to determine the Public folder tree in an
Event Agent Script. However my code fails to get the parent folder
correctly of the Agents home folder. Any thoughts?

Here is my attempted Script:

'------------------------------------------------------------------------------

'   Name: BuildMsgShortCut
'   Area: Outlook Workflow
'   Desc: Builds Outlook Message ShortCut
'   Parm: Object MAPI folder, Object MAPI Message
'------------------------------------------------------------------------------

Private Function BuildMsgShortCut(oFolder, oMsg)

 dim strShortCut
 dim oParentFolder
 dim oParent

On Error Resume Next

 strShortCut = oFolder.Name & "/~" & oMsg.Subject & ">"

' set oParent = oFolder.Parent
 If (Not Err.Number = 0)  OR (oParent is nothing) Then
      ' Error Getting Parent
      Call DebugAppend("Error - Getting Primary Folder Parent", True)
      Exit Function
 End If
 do until oParent.Class = g_Const_CdoInfoStore
      set oParentFolder = oParent.Parent

      If Not Err.Number = 0 Then
           ' Error Getting Collection Parent
           Call DebugAppend("Error - Getting Folders Collection Parent",
True)
           Exit Function
      End If

      strShortCut = oParentFolder.Name & "/" & strShortCut

      set oParent = oParentFolder.Parent

      If Not Err.Number = 0 Then
           ' Error Getting Parent
           Call DebugAppend("Error - Getting Secondary Folder Parent",
True)
           Exit Function
      End If

 loop

 strShortCut = "<outlook://Public Folders/All Public Folders/" &
strShortCut
 BuildMsgShortCut = strShortCut
End Function

2. WAP Server

3. Script event not firing in public folder

4. Change default mailadress

5. script agent: processing OnMessageDeleted event in public folder

6. pop3 connector

7. "from address" - public folder event script

8. You're right with a nuance

9. Event script works in personal mailbox and not in public folder

10. Install and use Exchange Scripting Agent Event for a public folder

11. Script Public Folder Owner and Orphan Public Folders

12. MoveTo method in an Event script moves message to the parent folder of the intended folder

13. Why the script works in personnel folder but not in public folder