dotnet-api-docs
dotnet-api-docs copied to clipboard
No VB.net Example - ContentDisposition class
There are no examples for using with VB.net and C#.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 710b9d8c-a79e-685c-6d1c-e5c75b660138
- Version Independent ID: c3c22e6d-735c-aa8f-6cc2-31bfc1d0225d
- Content: ContentDisposition Class (System.Net.Mime)
- Content Source: xml/System.Net.Mime/ContentDisposition.xml
- Product: dotnet-api
- GitHub Login: @dotnet-bot
- Microsoft Alias: dotnetcontent
Thanks for your feedback @jbstcyr. This page does have a C# example but it's missing the VB version. We'll add this to our VB parity project at https://github.com/dotnet/docs/projects/77.
If I'm looking at the right page... the following code is the VB.NET version of the sample.
Sub CreateMessageInlineAttachment(server As String, attachmentPath As String)
' Create a message And set up the recipients.
Dim message = New MailMessage("[email protected]", "[email protected]", "An inline text message for you.", "Message: ")
' Attach the message string to this email message.
Using data = New Attachment(attachmentPath, MediaTypeNames.Text.Plain)
' Send attachmentPath as part of the email body.
message.Attachments.Add(data)
data.ContentDisposition.Inline = True
' Send the message.
' Include credentials if the server requires them.
Using client = New SmtpClient(server)
client.Credentials = CredentialCache.DefaultNetworkCredentials
client.Send(message)
End Using
End Using
End Sub
However, when I use the "pencil" to try to perform the edit. I'm having a hard time finding where exactly the sample should be placed in order to have it submitted for approval. (Yes, I'm a newb with regards to trying to contribute to the docs. ;-) )
So if you don't mind pointing out what I'm missing, I'm trainable. ;-)
Note that I did have to test and confirm that this is working this by modifying the code to use an external third-party email server. (And I should also mention that my C++ is very rusty; but I'm pretty sure the sample is converted properly... as it does function.)
Thanks for your feedback @jbstcyr. This page does have a C# example but it's missing the VB version. We'll add this to our VB parity project at https://github.com/dotnet/docs/projects/77.
I don't think the C# example exists... the sample I'm seeing is C++.
C++ is the default language displayed when VB is not available
Here you can see the samples being referenced: https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Net.Mime/ContentDisposition.xml#L49
You can replace that ~/samples/ in the beginning with https://github.com/dotnet/samples/blob/master/
So this is the C# version: https://github.com/dotnet/samples/blob/master/snippets/csharp/VS_Snippets_Remoting/NCLMailSync/CS/mail.cs
So you could add the VB version to the following path: https://github.com/dotnet/samples/blob/master/snippets/visualbasic/VS_Snippets_Remoting/NCLMailSync/VB/mail.vb