Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15067

Only read unread emails, set to read and move to deleted folder in Web Services

$
0
0
I am using Microsoft.Exchange.WebServices nuget package in VB.Net. I have the following code to read data in an email, but I cannot figure out 3 things:

1. Read only unread emails
2. Set email to read after getting data from it
3. Move email to deleted folder

Could you please help? Thank you.

Code:

Dim serverURI As New Uri("https://corpmail.....com/ews/exchange.asmx")
        Dim exch As New Microsoft.Exchange.WebServices.Data.ExchangeService()
        exch.Url = serverURI
        exch.UseDefaultCredentials = False
        exch.Credentials = New System.Net.NetworkCredential("username", "password", "domain")


        Dim iv As ItemView = New ItemView(999)
        iv.Traversal = ItemTraversal.Shallow
        Dim inboxItems As FindItemsResults(Of Item) = Nothing
        inboxItems = exch.FindItems(WellKnownFolderName.Inbox, iv)
        'Dim Count As Integer = inboxItems.Count

        For Each i As Item In inboxItems
            MsgBox("this is" & i.Subject)
        Next


Viewing all articles
Browse latest Browse all 15067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>