Skip to content
Open
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
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ The EWS Toolkit is a .NET Framework Library that wraps around the EWS Managed AP

## Example

Auth and send email
```
using Toolkit;

Expand All @@ -13,6 +14,8 @@ namespace DemoApp
{
static void Main(string[] args)
{
//Program.exe random@example.org Passw0rd123

var connection = new ExchangeConnection(ExchangeVersion.Exchange2013_SP1);
connection.SetConnectionCredentials(args[0], args[1].ToSecureString());
connection.SetAutodiscoverUrl(args[0]);
Expand All @@ -25,4 +28,37 @@ namespace DemoApp
}
}
}
```
```

Auth and search for keywords in the inbox and sent folders
```
using Toolkit;

namespace DemoApp
{
class Program
{
static void Main(string[] args)
{

//Program.exe random@example.org Passw0rd123

ExchangeConnection connection = new ExchangeConnection(ExchangeVersion.Exchange2013_SP1);
connection.SetConnectionCredentials(args[0], args[1].ToSecureString());
connection.SetAutodiscoverUrl(args[0]);

Search searchData = new Search(connection);

//Add single search terms
searchData.AddBodySearchTerm("Administrator");
searchData.AddSubjectSearchTerm("Support");

//Add multi search terms
searchData.AddBodySearchTerms(new string[] { "Password", "Login" });
searchData.AddSubjectSearchTerms(new string[] { "Onboarding", "Welcome" });

List<SearchResult> searchResult = searchData.SearchFolder(FolderName.Inbox | FolderName.SentItems);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this actually work? I've never tried it 😅

Copy link
Copy Markdown
Author

@Flangvik Flangvik Sep 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😆 You don't test either? 🤣 Will looking into testing this

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, I just mean passing multiple target folders into the search. I've tested it with one, but not multiple.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, gotcha. I've seen it used like this before, so I just assumed. I haven't got around to set up an exchange in my lab yet, so feel free to test it. 🏎️

}
}
}
```