none
Problem: Edit email created by API using outlook RRS feed

  • Question

  • Hello!

    i try to explain my situation, i create a mailmessage in this way:

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    
            Dim service As New ExchangeService()
            service.Credentials = New Net.NetworkCredential("email@email.it", "<MyPassword>", "myDomain.it")
            service.Url = New Uri("https://outlook.office365.com/ews/exchange.asmx")
    
            Dim message As New EmailMessage(service)
            message.From = New EmailAddress("email@email.it", "email@email.it")
            message.Subject = "TEST_1"
            message.Body = "Test exchange Defer mail"
            message.ToRecipients.Add("andrea_xxxx@hotmail.com")
    
            Dim PR_DEFERRED_SEND_TIME As New ExtendedPropertyDefinition(16367, MapiPropertyType.SystemTime)
            
            Dim dtAppo As DateTime = Now.AddSeconds(30)
            Dim sendTime As String = dtAppo.ToUniversalTime.ToString("o")
    
            message.SetExtendedProperty(PR_DEFERRED_SEND_TIME, sendTime)message.Save(WellKnownFolderName.Drafts)
    
           message.Save(WellKnownFolderName.Draft)
           message.SendAndSaveCopy(WellKnownFolderName.SentItems)
    
    
            Me.Close()
    
        End Sub

    I can edit it using Outlook

    but when exchange sends the email (30 sec deffered) is sent without any changes made by the editor of outlook.

    it seems that I edit a copy and not the email exchange that sends

    <o:p>Andrea</o:p>

    Thursday, November 24, 2016 6:45 PM

All replies

  • Why are you using a deferred send ? Why don't you just save the message as a draft first then make your changes then send it ? clients work asynchronously the EWS Send is also an Async operation

    Cheers
    Glen


    Friday, November 25, 2016 4:47 AM
  • Because I'd like to schedule the email at a certain time.

    If the customer is interested tochange some I would give him the opportunity to do.  

    Usually emails are changedfrom Outlook client and not by my application. :)

    Friday, November 25, 2016 7:07 AM
  • >> Because I'd like to schedule the email at a certain time.

    That can be achieved using other methods

    Is the message sitting in the Outbox at the time its modified using outlook ? are you using Outlook in Cached or Online mode have you tried changing to Online Mode if using Cached mode.

    Sunday, November 27, 2016 11:40 PM
  • > > Is the message sitting in the Outbox at the time its modified using outlook ?

    No, i have to manually save the message on a folder ( Draft or other folter)  to display the message on Outlook.

    What's the best methods to shedule an email by code and let user modify it using outlook?

    Monday, November 28, 2016 8:03 AM
  • The way deferred Send work is the message goes into the Outbox (just try it yourself in Outlook) that is where you should be making any edits in Outlook.

    >> What's the best methods to shedule an email by code and let user modify it using outlook?

    The way I would do it would be save the message as a Draft in  afolder that the user would understand are scheduled messages. And then just write a scheduled job to send it eg https://azure.microsoft.com/en-us/services/scheduler/ its easy to use but you can write your own scheduler. But really this seems confusing for a user and I would doubt it will work well in production. I would force the use of a application to do it honestly then you have full control, it will be a reliable process, its logically and easily supportable the people who need to use it if you make it a good experience in UI will generally fall in line (IMO).

    Cheers
    Glen

    Tuesday, November 29, 2016 1:23 AM