More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

Login

login
password
Remember me

You will need to register and log in if you want to download the source code for the Microsoft Outlook Programming book. The forums and code sharing areas are open to both registered and non-registered visitors.

share code 02-Sep-2010 22:32

Looking for help with Outlook programming projects — VSTO, add-ins, VBA, custom Outlook forms, etc.? You′ve come to the right place!

NEW! >> Subscribe to this site via RSS. For more RSS options, see the complete list of feeds on our main news page.

 

Code level: advanced    Code area: Outlook Expert Techniques Printer Friendly Version
Title: How to Add/Change Recipients in an Outlook Agent
Description: This is a work in progress, but works for most of the things we want it to do.
Date: 22-May-2003  06:07
Code level: advanced
Code area: Outlook Expert Techniques
Posted by: Joel Foudy
Body:
All 2comments
Page [ 1  
  22-May-2003  13:20   
Ok, Here's my problem. Right now the meeting response (objMtgResp object) sends a confirmation back to the Organizer of the meeting. I'd like to change this to go to the person who accepts the meeting instead, but I'm not sure how to code that. Any help such as sample code or a reference guide to help me would be great. Thanks!



(To test and run this code add an Agent on a persons inbox that processes when new messages arrive. You must have and Exchange server to do this. If you don't have an Agents tab add the Server Scripting add-in for Outlook.)
  02-Dec-2003  10:16   
Hello Joel,
I used the Ressource Scripting example from Microsoft to and I add some function in addition. I send an information to everyone who is invited by the Organizer. I create a Procedure SendInfoMailToRecipients (...) You can call this procedure by:
SendInfoMailToRecipients EventDetails.Session, oMtg, "Buchung storniert: " & oMtg.Subject , "Termin: " & vbCrLf & oMtg.Subject & vbCrLf & oMtg.Text & vbCrLf & "Bitte loschen Sie diesen Termin aus Ihrem Kalender; Sie werden ggfs. erneut eingeladen."

 '---------------------------------------------------------------------'
 ' Name: SentNewMsg ( ... )
 ' Zweck: Benachrichtigungsmail versenden
 '
 ' Parm: oSession = Aktuelle Session
 ' strSubject = Betreff
 ' strMsg = Benachrichtigungstext der gesendet werden soll
 ' strTo = User an den gesendet werden soll (kann auch ein Verteiler sein)
 '
 '---------------------------------------------------------------------'
 '
Sub SentNewMsg (oSession, strSubject,strMsg,strTo)
'Benachrichtigung erzeugen und Senden

Dim oRecipient
Dim oNotifyMsg
Dim oFolderOutbox

        Err.Clear
        Set oFolderOutbox = oSession.Outbox

        Set oNotifyMsg = oFolderOutbox.Messages.Add
        If strSubject "" Then
        Else
           strSubject = Now
        End If

        If Err.Number = 0 Then
          oNotifyMsg.Subject = strSubject
          oNotifyMsg.Text = strMsg
          ' Set recipient
          Set oRecipient = oNotifyMsg.Recipients.Add
          oRecipient.Name = strTo
          oRecipient.Resolve
           If Err.Number 0 Then
             Call DebugAppend("Fehler - Empfanger konnte nicht aufgelost werden: " & strTo, True)
          Else

            ' Sent message
            oNotifyMsg.Update
            oNotifyMsg.Send

               If Err.Number 0 then
              Call DebugAppend("Fehler - Benachrichtigung konnte nicht gesendet werden.", True)
            Else
              Call DebugAppend("Erfolgreich - Nachricht wurde gesendet an: " & strTo, False)
            End If
          End If

        Else
          Call DebugAppend("Fehler - Es konnte keine Benachrichtigungsmeldung erzeugt werden.", True)
        End If

End Sub


'-----------------------------------------------------------------'
' Name: SendInfoMail
' Desc: Sendet eine Info-Mail an die eingeladeten Besprechungsteilnemer
' Parm: oMtg , strSubject , strInfo
' Retn: -
'-----------------------------------------------------------------'
Sub SendInfoMailToRecipients ( objSession, oMtg, strSubject, strInfo)
Dim strEmpfaenger
Dim Empfaenger
Dim strHilf

For EACH Empfaenger In oMtg.Recipients
           
                strEmpfaenger = UCase(Empfaenger.Address)
                strHilf = UCase ("EX:" & objSession.CurrentUser.Address)
                If strEmpfaenger strHilf Then
         SentNewMsg objSession, strSubject,strInfo,strEmpfaenger
         Call DebugAppend("SendInfoMail(): strHilf =" & strHilf & " strEmpfaenger = " & strEmpfaenger & " wurde INFO gesendet!" , FALSE)
                Else
      Call DebugAppend("SendInfoMail(): Empfanger:" & strEmpfaenger & " wurde ausgelassen!" , FALSE)
                End If
Next

End Sub

I hope it is not to late to help you?

Best Regards
Norbert Nellen (MCP W2K)
NNellen01@yahoo.de
 
Page [ 1  
Post your comment



name        email