1 '---------------------------------------------------------------------
2 ' This file is part of the Windows Workflow Foundation SDK Code Samples.
4 ' Copyright (C) Microsoft Corporation. All rights reserved.
6 'This source code is intended only as a supplement to Microsoft
7 'Development Tools and/or on-line documentation. See these other
8 'materials for detailed information regarding Microsoft code samples.
10 'THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
11 'KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
12 'IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
14 '---------------------------------------------------------------------
17 Imports System
.Workflow
.ComponentModel
18 Imports System
.Windows
.Forms
19 Imports Outlook
= Microsoft
.Office
.Interop
.Outlook
20 Imports System
.Workflow
.Activities
22 Public Class AutoReplyEmail
23 Inherits System
.Workflow
.ComponentModel
.Activity
25 Protected Overrides
Function Execute(ByVal executionContext
As System
.Workflow
.ComponentModel
.ActivityExecutionContext
) As System
.Workflow
.ComponentModel
.ActivityExecutionStatus
26 ' Create an Outlook Application object.
27 Dim outlookApp
As Outlook
.Application
= New Outlook
.Application()
29 Dim oMailItem
As Outlook
._MailItem
= CType(outlookApp
.CreateItem(Outlook
.OlItemType
.olMailItem
), Outlook
._MailItem
)
30 oMailItem
.To = outlookApp
.Session
.CurrentUser
.Address
31 oMailItem
.Subject
= "Auto-Reply"
32 oMailItem
.Body
= "Out of Office"
36 If TypeOf
Me.Parent
.Parent Is ParallelActivity
Then
37 dummy
= Me.Parent
.Parent
.Parent
.Activities
.Item(1)
38 If Not (CType(dummy
, DummyActivity
).Title
= "") Then
39 MessageBox
.Show("Process Auto-Reply for Email")
43 If TypeOf
Me.Parent
.Parent Is SequentialWorkflowActivity
Then
44 dummy
= Me.Parent
.Parent
.Activities
.Item(1)
45 If Not (CType(dummy
, DummyActivity
).Title
= "") Then
46 MessageBox
.Show("Process Auto-Reply for Email")
51 Return ActivityExecutionStatus
.Closed
54 Dim smtpHostValue
As String
55 Public Property SmtpHost() As String
57 Return Me.smtpHostValue
59 Set(ByVal value
As String)
60 Me.smtpHostValue
= value
64 Dim fromEmailValue
As String
65 Public Property FromEmail() As String
67 Return Me.fromEmailValue
69 Set(ByVal value
As String)
70 Me.fromEmailValue
= value
75 Public Property [To]() As String
79 Set(ByVal value
As String)
84 Dim subjectValue
As String
85 Public Property Subject() As String
87 Return Me.subjectValue
89 Set(ByVal value
As String)
90 Me.subjectValue
= value