SendMailTask.FileAttachments Özelliği
Alır veya ayarlar, birden fazla dosya olduğunda çubuk karakteri (|) ayrılmış e-posta iletisine eklenen dosya adlarını.
Ad Alanı: Microsoft.SqlServer.Dts.Tasks.SendMailTask
Derleme: Microsoft.SqlServer.SendMailTask (Microsoft.SqlServer.SendMailTask içinde.dll)
Sözdizimi
'Bildirim
Public Property FileAttachments As String
Get
Set
'Kullanım
Dim instance As SendMailTask
Dim value As String
value = instance.FileAttachments
instance.FileAttachments = value
public string FileAttachments { get; set; }
public:
virtual property String^ FileAttachments {
String^ get () sealed;
void set (String^ value) sealed;
}
abstract FileAttachments : string with get, set
override FileAttachments : string with get, set
final function get FileAttachments () : String
final function set FileAttachments (value : String)
Özellik Değeri
Tür: System.String
A dize e-posta iletisine eklenen dosya adlarını içeren.
Uygulamalar
Açıklamalar
Dosya adı belirterek görev oluşturduğunuzda, bir dosyanın statik bir kopyasını iliştirebilir FileAttachments 'ın özellik veya üzerine bir dosya konumuna çalışma sırasında dinamik olarak güncelleştirilen bir dosya göndermek için bir değişken, bir yapılandırma veya bir özellik deyimi kullanarak saat onun yerine.Bu özellik, günlük ve özel dosyaları gibi ekleri göndermek için yararlıdır.Dosya adları çubuk karakteri (|) ile ayırarak, birden çok ek bir görev ekleyebilirsiniz.
Not
Paket, paket çalıştırıldığında ek dosya yoksa, bir hata iletisi yükseltir.
Örnekler
Aşağıdaki kod örneği oluşturur, yapılandırır ve yeni bir yürütür SendMailTask kullanan FileAttachments özellik.
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts.Tasks.SendMailTask
Module Module1
Sub Main()
Dim pkg As New Package
Dim smtpCM As ConnectionManager
smtpCM = pkg.Connections.Add("SMTP")
smtpCM.Name = "SMTP Connection Manager"
smtpCM.ConnectionString = "smtphost"
Dim exe As Executable = pkg.Executables.Add("STOCK:SendMailTask")
Dim thSendMailTask As TaskHost = CType(exe, TaskHost)
With thSendMailTask
.Properties("SmtpConnection").SetValue(thSendMailTask, "SMTP Connection Manager")
.Properties("ToLine").SetValue(thSendMailTask, "someone1@example.com")
.Properties("CCLine").SetValue(thSendMailTask, "someone2@example.com")
.Properties("BCCLine").SetValue(thSendMailTask, "someone3@example.com")
.Properties("FromLine").SetValue(thSendMailTask, "someone4@example.com")
.Properties("Priority").SetValue(thSendMailTask, MailPriority.Normal)
.Properties("FileAttachments").SetValue(thSendMailTask, "C:\test_image.jpg")
.Properties("Subject").SetValue(thSendMailTask, "Testing the SendMail Task")
.Properties("MessageSourceType").SetValue(thSendMailTask, SendMailMessageSourceType.DirectInput)
.Properties("MessageSource").SetValue(thSendMailTask, "This is only a test.")
End With
Dim valResults As DTSExecResult = pkg.Validate(pkg.Connections, pkg.Variables, Nothing, Nothing)
If valResults = DTSExecResult.Success Then
pkg.Execute()
End If
End Sub
End Module
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts.Tasks.SendMailTask
Module TestSendMailTask
Sub Main()
Dim pkg As New Package
Dim smtpCM As ConnectionManager
smtpCM = pkg.Connections.Add("SMTP")
smtpCM.Name = "SMTP Connection Manager"
smtpCM.ConnectionString = "smtphost"
Dim exe As Executable = pkg.Executables.Add("STOCK:SendMailTask")
Dim thSendMailTask As TaskHost = CType(exe, TaskHost)
With thSendMailTask
.Properties("SmtpConnection").SetValue(thSendMailTask, "SMTP Connection Manager")
.Properties("ToLine").SetValue(thSendMailTask, "someone1@example.com")
.Properties("CCLine").SetValue(thSendMailTask, "someone2@example.com")
.Properties("BCCLine").SetValue(thSendMailTask, "someone3@example.com")
.Properties("FromLine").SetValue(thSendMailTask, "someone4@example.com")
.Properties("Priority").SetValue(thSendMailTask, MailPriority.Normal)
.Properties("FileAttachments").SetValue(thSendMailTask, "C:\test_image.jpg")
.Properties("Subject").SetValue(thSendMailTask, "Testing the SendMail Task")
.Properties("MessageSourceType").SetValue(thSendMailTask, SendMailMessageSourceType.DirectInput)
.Properties("MessageSource").SetValue(thSendMailTask, "This is only a test.")
End With
Dim valResults As DTSExecResult = pkg.Validate(pkg.Connections, pkg.Variables, Nothing, Nothing)
If valResults = DTSExecResult.Success Then
pkg.Execute()
End If
End Sub
End Module