Mick W
Mick W

Reputation: 1

C# reading Emails from MS Exchange

Hi I am new to c# and have been asked to read in the title and contents of emails that arrive in a particular email account and them store them in SQL. I initially thought this must be easy but I cannot find any simple tutorials or samples.

Can anyone help?

Upvotes: 0

Views: 3247

Answers (1)

Incognito
Incognito

Reputation: 16577

Check HERE: something similar already discussed. Mainly, you can use :

If you will use EWS here is some sample :

    ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1); // depends from Exchange server version 
    //service.Credentials = new NetworkCredential( "{Active Directory ID}", "{Password}", "{Domain Name}" );
    service.AutodiscoverUrl( "[email protected]" );
    FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox,
          new ItemView( 10 ) );
    foreach ( Item item in findResults.Items )
    {
       Console.WriteLine( item.Subject );
    }

Upvotes: 1

Related Questions