0 Replies - 955 Views - Last Post: 17 September 2020 - 12:55 PM Rate Topic: -----

#1 nico123   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 39
  • Joined: 16-October 13

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

Posted 17 September 2020 - 12:55 PM

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.

  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

This post has been edited by nico123: 17 September 2020 - 12:56 PM


Is This A Good Question/Topic? 0
  • +

Page 1 of 1