Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Examples are organized by feature category:
- `working-with-exchange-webdav-client/` - 41 example(s)
- `working-with-ibm-notes/` - 30 example(s)
- `working-with-imap-client/` - 59 example(s)
- `working-with-microsoft-graph-client/` - 32 example(s)
- `working-with-microsoft-graph-client/` - 33 example(s)
- `working-with-mime-messages/` - 121 example(s)
- `working-with-outlook-storage-files/` - 61 example(s)
- `working-with-pop3-client/` - 40 example(s)
Expand Down
6 changes: 3 additions & 3 deletions agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ When working in this repository:
- Follow the conventions and anti-patterns below exactly.

## Repository Overview
This repository currently contains **695** working code examples across **14** categories.
This repository currently contains **696** working code examples across **14** categories.

### Category Details
- **convert-between-formats** — 40 examples. Guide: [agents.md](./convert-between-formats/agents.md)
Expand All @@ -29,7 +29,7 @@ This repository currently contains **695** working code examples across **14** c
- **working-with-exchange-webdav-client** — 41 examples. Guide: [agents.md](./working-with-exchange-webdav-client/agents.md)
- **working-with-ibm-notes** — 30 examples. Guide: [agents.md](./working-with-ibm-notes/agents.md)
- **working-with-imap-client** — 59 examples. Guide: [agents.md](./working-with-imap-client/agents.md)
- **working-with-microsoft-graph-client** — 32 examples. Guide: [agents.md](./working-with-microsoft-graph-client/agents.md)
- **working-with-microsoft-graph-client** — 33 examples. Guide: [agents.md](./working-with-microsoft-graph-client/agents.md)
- **working-with-mime-messages** — 121 examples. Guide: [agents.md](./working-with-mime-messages/agents.md)
- **working-with-outlook-storage-files** — 61 examples. Guide: [agents.md](./working-with-outlook-storage-files/agents.md)
- **working-with-pop3-client** — 40 examples. Guide: [agents.md](./working-with-pop3-client/agents.md)
Expand Down Expand Up @@ -63,5 +63,5 @@ Success = exit code 0 and no `CS####` compiler errors.
<!-- AUTOGENERATED:START -->
| Date | Run ID | Branch/Commit |
|------|--------|---------------|
| 2026-04-01 | `20260401_045820` | [examples/batch-20260401_045820](https://github.com/aspose-email/agentic-net-examples/tree/examples/batch-20260401_045820) |
| 2026-04-02 | `20260402_140217` | [examples/batch-20260402_140217](https://github.com/aspose-email/agentic-net-examples/tree/examples/batch-20260402_140217) |
<!-- AUTOGENERATED:END -->
2 changes: 1 addition & 1 deletion convert-between-formats/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,5 @@ See the root [agents.md](../agents.md) for repository-wide conventions.
<!-- AUTOGENERATED:START -->
| Date | Run ID | Branch/Commit |
|------|--------|---------------|
| 2026-04-01 | `20260401_045820` | [examples/batch-20260401_045820](https://github.com/aspose-email/agentic-net-examples/tree/examples/batch-20260401_045820) |
| 2026-04-02 | `20260402_140217` | [examples/batch-20260402_140217](https://github.com/aspose-email/agentic-net-examples/tree/examples/batch-20260402_140217) |
<!-- AUTOGENERATED:END -->
37 changes: 19 additions & 18 deletions index.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"platform": "net",
"framework": "net8.0",
"package_version": "26.1.0",
"total_examples": 695,
"total_examples": 696,
"total_categories": 14,
"last_updated": "2026-04-01",
"last_updated": "2026-04-02",
"categories": [
{
"name": "convert-between-formats",
Expand Down Expand Up @@ -699,16 +699,16 @@
"count": 30
},
{
"name": "System.Net",
"count": 10
"name": "System.IO",
"count": 9
},
{
"name": "Aspose.Email.Tools.Search",
"count": 8
"name": "System.Net",
"count": 9
},
{
"name": "System.IO",
"count": 8
"name": "Aspose.Email.Tools.Search",
"count": 7
},
{
"name": "Aspose.Email.Calendar",
Expand Down Expand Up @@ -950,7 +950,7 @@
},
{
"name": "working-with-microsoft-graph-client",
"file_count": 32,
"file_count": 33,
"files": [
"authenticate-with-azure-active-directory-via-microsoft-graph-client-using-office-credentials-extracted-from-an-msg-file.cs",
"copy-an-msg-format-email-message-to-a-destination-mailbox-utilizing-the-microsoft-graph-client-api.cs",
Expand All @@ -973,6 +973,7 @@
"retrieve-an-msg-format-attachment-via-the-microsoft-graph-client-handling-authentication-and-response-parsing.cs",
"retrieve-an-msg-formatted-email-message-using-the-microsoft-graph-client-api-and-process-its-contents.cs",
"retrieve-message-rules-from-an-msg-file-by-utilizing-the-microsoft-graph-client-api.cs",
"retrieve-the-message-category-from-an-msg-file-using-the-microsoft-graph-client-library.cs",
"retrieve-the-tasks-list-embedded-within-an-msg-file-using-the-microsoft-graph-client-api.cs",
"use-microsoft-graph-client-to-enumerate-steps-for-creating-an-azure-ad-admin-center-project-from-an-msg-file.cs",
"utilize-microsoft-graph-client-to-add-the-msal-net-package-and-install-the-microsoft-identity-client-nuget-containing.cs",
Expand All @@ -988,27 +989,27 @@
"required_namespaces": [
{
"name": "System",
"count": 32
"count": 33
},
{
"name": "Aspose.Email",
"count": 32
"count": 33
},
{
"name": "Aspose.Email.Clients",
"count": 32
"count": 33
},
{
"name": "Aspose.Email.Clients.Graph",
"count": 32
"count": 33
},
{
"name": "System.IO",
"count": 25
"count": 27
},
{
"name": "Aspose.Email.Mapi",
"count": 22
"count": 26
},
{
"name": "System.Collections.Generic",
Expand Down Expand Up @@ -1170,7 +1171,7 @@
},
{
"name": "Aspose.Email.Mapi",
"count": 68
"count": 67
},
{
"name": "System.Security.Cryptography.X509Certificates",
Expand All @@ -1182,7 +1183,7 @@
},
{
"name": "Aspose.Email.Mime",
"count": 7
"count": 6
},
{
"name": "System.Collections.Generic",
Expand Down Expand Up @@ -1304,7 +1305,7 @@
},
{
"name": "System.Collections.Generic",
"count": 9
"count": 8
},
{
"name": "Aspose.Email.Tools.Search",
Expand Down
2 changes: 1 addition & 1 deletion programming-email-verification/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ See the root [agents.md](../agents.md) for repository-wide conventions.
<!-- AUTOGENERATED:START -->
| Date | Run ID | Branch/Commit |
|------|--------|---------------|
| 2026-04-01 | `20260401_045820` | [examples/batch-20260401_045820](https://github.com/aspose-email/agentic-net-examples/tree/examples/batch-20260401_045820) |
| 2026-04-02 | `20260402_140217` | [examples/batch-20260402_140217](https://github.com/aspose-email/agentic-net-examples/tree/examples/batch-20260402_140217) |
<!-- AUTOGENERATED:END -->
2 changes: 1 addition & 1 deletion programming-with-gmail/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@ See the root [agents.md](../agents.md) for repository-wide conventions.
<!-- AUTOGENERATED:START -->
| Date | Run ID | Branch/Commit |
|------|--------|---------------|
| 2026-04-01 | `20260401_045820` | [examples/batch-20260401_045820](https://github.com/aspose-email/agentic-net-examples/tree/examples/batch-20260401_045820) |
| 2026-04-02 | `20260402_140217` | [examples/batch-20260402_140217](https://github.com/aspose-email/agentic-net-examples/tree/examples/batch-20260402_140217) |
<!-- AUTOGENERATED:END -->
2 changes: 1 addition & 1 deletion working-with-amp-html-emails/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ See the root [agents.md](../agents.md) for repository-wide conventions.
<!-- AUTOGENERATED:START -->
| Date | Run ID | Branch/Commit |
|------|--------|---------------|
| 2026-04-01 | `20260401_045820` | [examples/batch-20260401_045820](https://github.com/aspose-email/agentic-net-examples/tree/examples/batch-20260401_045820) |
| 2026-04-02 | `20260402_140217` | [examples/batch-20260402_140217](https://github.com/aspose-email/agentic-net-examples/tree/examples/batch-20260402_140217) |
<!-- AUTOGENERATED:END -->
2 changes: 1 addition & 1 deletion working-with-exchange-ews-client/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,5 @@ See the root [agents.md](../agents.md) for repository-wide conventions.
<!-- AUTOGENERATED:START -->
| Date | Run ID | Branch/Commit |
|------|--------|---------------|
| 2026-04-01 | `20260401_045820` | [examples/batch-20260401_045820](https://github.com/aspose-email/agentic-net-examples/tree/examples/batch-20260401_045820) |
| 2026-04-02 | `20260402_140217` | [examples/batch-20260402_140217](https://github.com/aspose-email/agentic-net-examples/tree/examples/batch-20260402_140217) |
<!-- AUTOGENERATED:END -->
8 changes: 4 additions & 4 deletions working-with-exchange-webdav-client/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ See the root [agents.md](../agents.md) for repository-wide conventions.
- `using Aspose.Email;` (39 file(s))
- `using Aspose.Email.Clients.Exchange.Dav;` (32 file(s))
- `using Aspose.Email.Clients.Exchange;` (30 file(s))
- `using System.Net;` (10 file(s))
- `using Aspose.Email.Tools.Search;` (8 file(s))
- `using System.IO;` (8 file(s))
- `using System.IO;` (9 file(s))
- `using System.Net;` (9 file(s))
- `using Aspose.Email.Tools.Search;` (7 file(s))
- `using Aspose.Email.Calendar;` (4 file(s))
- `using Aspose.Email.Clients.Smtp;` (3 file(s))
- `using Aspose.Email.Mapi;` (3 file(s))
Expand Down Expand Up @@ -86,5 +86,5 @@ See the root [agents.md](../agents.md) for repository-wide conventions.
<!-- AUTOGENERATED:START -->
| Date | Run ID | Branch/Commit |
|------|--------|---------------|
| 2026-04-01 | `20260401_045820` | [examples/batch-20260401_045820](https://github.com/aspose-email/agentic-net-examples/tree/examples/batch-20260401_045820) |
| 2026-04-02 | `20260402_140217` | [examples/batch-20260402_140217](https://github.com/aspose-email/agentic-net-examples/tree/examples/batch-20260402_140217) |
<!-- AUTOGENERATED:END -->
Original file line number Diff line number Diff line change
@@ -1,66 +1,77 @@
using Aspose.Email.Clients.Exchange;
using System;
using System.Net;
using System.IO;
using Aspose.Email;
using Aspose.Email.Clients.Exchange.Dav;
using Aspose.Email.Tools.Search;

namespace AsposeEmailWebDavFilterExample
class Program
{
class Program
static void Main()
{
static void Main()
try
{
try
{
// Placeholder connection settings – replace with real values.
string serverUri = "https://exchange.example.com/EWS/Exchange.asmx";
string username = "username";
string password = "password";
// Placeholder connection settings
string mailboxUri = "https://exchange.example.com/ews/Exchange.asmx";
string username = "username";
string password = "password";

// Guard against executing with placeholder credentials.
if (serverUri.Contains("example.com") || username == "username" || password == "password")
{
Console.Error.WriteLine("Placeholder credentials detected. Skipping execution.");
return;
}
// Skip execution if placeholder credentials are detected
if (mailboxUri.Contains("example.com") || username == "username")
{
Console.Error.WriteLine("Placeholder credentials detected. Skipping execution.");
return;
}

// Create and connect the Exchange WebDAV client.
// Create and use the Exchange client
using (ExchangeClient client = new ExchangeClient(mailboxUri, username, password))
{
try
{
using (ExchangeClient client = new ExchangeClient(serverUri, username, password))
// Retrieve messages from the Inbox folder that match the query.
string query = "HasAttachment = True AND IsRead = False";
ExchangeMessageInfoCollection messages = client.ListMessages(client.MailboxInfo.InboxUri, query);
foreach (var msgInfo in messages)
{
// Build a query to retrieve only unread messages that have attachments.
// The query language follows the Exchange MailQuery syntax.
MailQuery query = new MailQuery("HasAttachment = True AND IsRead = False");
// Fetch the full message
using (MailMessage message = client.FetchMessage(msgInfo.UniqueUri))
{
Console.WriteLine($"Subject: {message.Subject}");

// List messages from the Inbox that match the query (recursive = false).
ExchangeMessageInfoCollection messages = client.ListMessages(
client.MailboxInfo.InboxUri,
query,
false);
// Prepare output directory and file path
string outputDir = "Output";
string outputPath = Path.Combine(outputDir, "FirstMessage.eml");

// Process the filtered messages.
foreach (ExchangeMessageInfo info in messages)
{
Console.WriteLine("Subject: " + info.Subject);
Console.WriteLine("Has Attachments: " + info.HasAttachments);
Console.WriteLine("Received: " + info.InternalDate);
Console.WriteLine(new string('-', 40));
// Ensure the output directory exists
if (!Directory.Exists(outputDir))
{
Directory.CreateDirectory(outputDir);
}

// Save the message to a file with error handling
try
{
message.Save(outputPath);
Console.WriteLine($"Message saved to {outputPath}");
}
catch (Exception ex)
{
Console.Error.WriteLine($"Failed to save message: {ex.Message}");
}
}

// Process only the first message
break;
}
}
catch (Exception ex)
{
Console.Error.WriteLine("Error during client operation: " + ex.Message);
return;
Console.Error.WriteLine($"Error during Exchange operations: {ex.Message}");
}
}
catch (Exception ex)
{
Console.Error.WriteLine("Unhandled exception: " + ex.Message);
return;
}
}
catch (Exception ex)
{
Console.Error.WriteLine($"Unhandled exception: {ex.Message}");
}
}
}
2 changes: 1 addition & 1 deletion working-with-ibm-notes/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ See the root [agents.md](../agents.md) for repository-wide conventions.
<!-- AUTOGENERATED:START -->
| Date | Run ID | Branch/Commit |
|------|--------|---------------|
| 2026-04-01 | `20260401_045820` | [examples/batch-20260401_045820](https://github.com/aspose-email/agentic-net-examples/tree/examples/batch-20260401_045820) |
| 2026-04-02 | `20260402_140217` | [examples/batch-20260402_140217](https://github.com/aspose-email/agentic-net-examples/tree/examples/batch-20260402_140217) |
<!-- AUTOGENERATED:END -->
2 changes: 1 addition & 1 deletion working-with-imap-client/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,5 @@ See the root [agents.md](../agents.md) for repository-wide conventions.
<!-- AUTOGENERATED:START -->
| Date | Run ID | Branch/Commit |
|------|--------|---------------|
| 2026-04-01 | `20260401_045820` | [examples/batch-20260401_045820](https://github.com/aspose-email/agentic-net-examples/tree/examples/batch-20260401_045820) |
| 2026-04-02 | `20260402_140217` | [examples/batch-20260402_140217](https://github.com/aspose-email/agentic-net-examples/tree/examples/batch-20260402_140217) |
<!-- AUTOGENERATED:END -->
Loading