added SSCLI 1.0
[windows-sources.git] / sdk / samples / WFSamples / Applications / OutlookWorkflowWizard / VB / ReadEmailActivity / AutoReplyEmail.vb
blobadb3b4183671d9e39d2b371f1b38f350d13b9716
1 '---------------------------------------------------------------------
2 ' This file is part of the Windows Workflow Foundation SDK Code Samples.
3 '
4 ' Copyright (C) Microsoft Corporation. All rights reserved.
5 '
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.
9 '
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
13 'PARTICULAR PURPOSE.
14 '---------------------------------------------------------------------
16 Imports System
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"
34 Dim dummy As Activity
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")
40 oMailItem.Send()
41 End If
42 End If
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")
47 oMailItem.Send()
48 End If
49 End If
51 Return ActivityExecutionStatus.Closed
52 End Function
54 Dim smtpHostValue As String
55 Public Property SmtpHost() As String
56 Get
57 Return Me.smtpHostValue
58 End Get
59 Set(ByVal value As String)
60 Me.smtpHostValue = value
61 End Set
62 End Property
64 Dim fromEmailValue As String
65 Public Property FromEmail() As String
66 Get
67 Return Me.fromEmailValue
68 End Get
69 Set(ByVal value As String)
70 Me.fromEmailValue = value
71 End Set
72 End Property
74 Dim toValue As String
75 Public Property [To]() As String
76 Get
77 Return Me.toValue
78 End Get
79 Set(ByVal value As String)
81 End Set
82 End Property
84 Dim subjectValue As String
85 Public Property Subject() As String
86 Get
87 Return Me.subjectValue
88 End Get
89 Set(ByVal value As String)
90 Me.subjectValue = value
91 End Set
92 End Property
93 End Class