Share via


Creating and Posting a Message

The following example describes a PostMsg procedure, which creates and posts a message in your workflow-enabled folder in response to workflow events.

Example Script

'// -----------------------------------------------------------------------------------
'// Name      : PostMsg
'// Purpose   : Posts a message in the designated folder for the user who initiated the action.
'// Prereq    : none
'// Inputs    : strSubject, subject for the post. StrDomain, domain where folder is located, strFolder location of the folder where item will be posted
'// Return    : Item posted in designated folder.
'// -----------------------------------------------------------------------------------
Sub PostMsg(strSubject, strDomain, strFolder)
  MyURL = "file://./backofficestorage/" & strDomain & "/Public Folders/" & strFolder
  Set MyMsg = CreateObject("CDO.Message") 
  MyMsg.Subject = strSubject 
  MyMsg.TextBody = "This is a Text Body" 
  MyMsg.From = WorkflowSession.Sender 
  MyMsg.DataSource.SaveTo MyURL & "/" & strSubject, Nothing
End Sub

See Also

Scripting in the Workflow Designer for Exchange Server | Script Examples for Exchange Server | Creating Script Procedures