//Create a new MapiAttachment using the byte array
< /code>
ist der folgende Fehler: < /p>
CS1729 'Mapiattachment' enthält keinen Konstruktor, der 2
Arguments.
< /blockquote>
Irgendwelche Zeiger, wie man dies umgeht? < /p>
private void AttachFileToEmail(MapiMessage email, string filePath)
{
if (!File.Exists(filePath))
{
MessageBox.Show($"File not found: {filePath}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
try
{
// Read the file as a byte array
byte[] fileBytes = File.ReadAllBytes(filePath);
// Get the file name
string fileName = Path.GetFileName(filePath);
// Create a new MapiAttachment using the byte array
MapiAttachment attachment = new MapiAttachment(fileName, new MemoryStream(fileBytes));
// Add the attachment to the email
email.Attachments.Add(attachment);
}
catch (Exception ex)
{
MessageBox.Show($"Error attaching file: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}`
< /code>
Ich habe auch den folgenden Code ausprobiert, aber immer noch keine Würfel, da ich einen weiteren Fehler erhielt < /p>
CS1503: Argument 2: Kann nicht [url=viewtopic.php?t=12659]Konvertieren[/url] Sie von 'system.io.memoryStream' in
'asspin.private void AttachFileToEmail(MapiMessage email, string filePath)
{
if (!File.Exists(filePath))
{
MessageBox.Show($"File not found: {filePath}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
try
{
string fileName = Path.GetFileName(filePath);
// Read file bytes
byte[] fileBytes = File.ReadAllBytes(filePath);
// Create a memory stream from the file bytes
using (MemoryStream memoryStream = new MemoryStream(fileBytes))
{
// Add the attachment using the correct method
email.Attachments.Add(fileName, memoryStream);
}
}
catch (Exception ex)
{
MessageBox.Show($"Error attaching file: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
im folgenden Code, irgendwie die neue Mapiattachment in diesem Abschnitt [code]//Create a new MapiAttachment using the byte array < /code> ist der folgende Fehler: < /p>
CS1729 'Mapiattachment' enthält keinen Konstruktor, der 2 Arguments. < /blockquote> Irgendwelche Zeiger, wie man dies umgeht? < /p> private void AttachFileToEmail(MapiMessage email, string filePath) { if (!File.Exists(filePath)) { MessageBox.Show($"File not found: {filePath}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; }
try { // Read the file as a byte array byte[] fileBytes = File.ReadAllBytes(filePath);
// Get the file name string fileName = Path.GetFileName(filePath);
// Create a new MapiAttachment using the byte array MapiAttachment attachment = new MapiAttachment(fileName, new MemoryStream(fileBytes));
// Add the attachment to the email email.Attachments.Add(attachment); } catch (Exception ex) { MessageBox.Show($"Error attaching file: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }` < /code> Ich habe auch den folgenden Code ausprobiert, aber immer noch keine Würfel, da ich einen weiteren Fehler erhielt < /p>
CS1503: Argument 2: Kann nicht [url=viewtopic.php?t=12659]Konvertieren[/url] Sie von 'system.io.memoryStream' in 'asspin.private void AttachFileToEmail(MapiMessage email, string filePath) { if (!File.Exists(filePath)) { MessageBox.Show($"File not found: {filePath}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; }
Ich versuche zum ersten Mal, einen Test für meine API zu schreiben und erhalte diesen Fehler
java.lang.AssertionError: JSON path „$“ Erwartet: eine Sammlung mit Größe , aber: Sammlungsgröße war . Ich...
Ich versuche zum ersten Mal, einen Test für meine API zu schreiben und erhalte diesen Fehler
java.lang.AssertionError: JSON path „$“ Erwartet: eine Sammlung mit Größe , aber: Sammlungsgröße war . Ich...
Ich bin also neu in Selen und habe nur versucht, einen einfachen Test durchzuführen, um zu sehen, ob es funktioniert hat. Nach der Installation aller erforderlichen Pakete (und dem Umgang mit anderen...
Ich habe ein Projekt mit TargetFramework netCoreApp2.1 . Wenn ich meinen Code wieder aufbaue, erhalte ich folgende Fehler: Version = 4.2.1.0, Culture = neutral, PublicKeyToken = B03F5F7F11D50A3A ',...
Ich bin Student und arbeite an einem Projekt. Die Prämisse ist, dass dieses Programm, an dem ich arbeite, als Input the Days (M-F), an denen ein Student eingeschrieben ist, die Anzahl der Stunden pro...