none
who's on first RRS feed

  • Question

  • Hi All

    With a lot of help from Ken and Dimitry I got my end result but not as expected.  I have a “multi-tier event structure” that captures the NewInspector event, which in turn sets up the capture for the inspector_activate event, which in turn sets up the capture for the item_reply event.  Ken and Dimitry got me passed the needed code construction in the activate event using the RDOMail object that effects a copy of the original “current item” to an RDOMail reflection in the drafts folder.  I am ultimately trying to change the “to/recipient” data based upon an address contained in the original message body.  In my original set up of the “reply” event prior to exit from the activate event I used the following line of code

    Set insReply = objSmail.item

    Where insReply is the defined name of the Reply event and objSmail.item is the redemption mailitem.  This construct works.

    The following code was introduced to create a copy of an RDOmailitem in the drafts folder to allow me to set that infamous “to” field to the desired address when the Reply function is selected/displayed.

        Dim sss As RDOSession

       Dim rdoMlItm As RDOMail

        Dim rdoMlItm2 As RDOMail

        Dim rdoFldr As RDOFolder

        Dim rdoitms As RDOItems

        Set sss = CreateObject("Redemption.RDOSession")

        sss.MAPIOBJECT = Application.Session.MAPIOBJECT

        Set rdoMlItm = sss.GetRDOObjectFromOutlookObject(objSmail)

        Set rdoFldr = sss.GetDefaultFolder(olFolderDrafts)

        Set rdoitms = rdoFldr.Items

        Set rdoMlItm2 = rdoitms.Add(olMailItem)

        rdoMlItm.CopyTo rdoMlItm2

     

        rdoMlItm2.To = variable address

        rdoMlItm2.Save

     

       Set insReply = rdoMlItem2  (item is not part of this construct)

    The above construct does NOT work – Type Mismatch.  Is the RDOMail item not a mailitem object?  I got around this problem by simply using the first construct to “activate the Reply event” and then reacquired rdoMlItm2 by use of its entryid in the Reply event.  I was then presented with the deeper question of what “data” set does the “default Reply Form” display?  I was thinking since I set the rdoMlItm2 object to the “working object” that this was now the “current.item” and therefore this would be the object passed to the display method that displays the default Reply form.  Not the case – I am not sure what “data set” it was using”.  In order to get my variable address to show in the “to” field of the Reply Form I had to do a rdoMlItm2.display followed by a cancel to stop the default reply form from being presented next.  I repeat my question:  What “Object” data set does the default Reply form display – the current.item I assume.  And if this is the case how do you predict what the current.item will be when the default Reply form is displayed?  Or any form for that matter!

    Besides the questions above here are the other questions that are really perplexing me.

      •      In recap: Can I set up the Reply event object to the rdoMlItm2 object?
      •      If I can do this, is the insReply.to data going to be equal to the rdoMlItm2.to data?
      •      Is Outlook then going to display the “insReply” object data in the Reply form?
      •      Is the “Response” passed object/parameter in the Reply event the Object that is passed to the “Application Itemsend” event?

    Thanks again to Ken and Dimitry for helping me get this app working (in spite of myself) but there are still a number of clouds blocking “my enlightenment”.

    Respectfully,

    Gordon Haas


    Gordon Haas

    Thursday, August 30, 2012 9:33 PM

Answers

  • You can't set an RDOMail item to an Outlook MailItem or vice versa. One is an Outlook object and the other is an object representing a MAPI IMessage. That's even though they both depict the same object and set of data.
     
    To go back and forth you must get the id's (EntryID and StoreID) and use the correct method for the object type (NameSpace.GetItemFromID or RDOSession.GetMessageFromID).
     
    When reply is clicked on an item, whether in an Inspector or an Explorer, the reply item that gets opened is an Outlook MailItem object. If reply is clicked in an Outlook item in an Inspector the reply is based on Inspector.CurrentItem. If it's in an Explorer then each item in Explorer.Selection is used as the basis for each reply.
     
    •      In recap: Can I set up the Reply event object to the rdoMlItm2 object?
    If the user is clicking Reply on an Outlook item an Outlook reply item will be created. If you call the Reply() method on an RDOMail item using code an RDOMail item is created as the reply. Make sure to save the original RDOMail item before calling Reply() though.
    •      If I can do this, is the insReply.to data going to be equal to the rdoMlItm2.to data?
    You can't do it unless code is used to create the reply item. If that is done the data in the RDOMail item is used to provision the reply item.
    •      Is Outlook then going to display the “insReply” object data in the Reply form?
    Not if the user clicks reply. If you do it in code and then display the RDOMail item you would see the RDOMail item. Why use code to set To though? I would use the Recipients collection myself, removing any I didn't want and adding those I wanted.
     
    I have handled reply items opening where I closed the original item and replaced it with one I wanted shown, the down side is a flicker in the UI often can be seen.
    •      Is the “Response” passed object/parameter in the Reply event the Object that is passed to the “Application Itemsend” event?
    I don't understand this question, please explain.
     
    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "saahg" <=?utf-8?B?c2FhaGc=?=> wrote in message news:dfff4143-d4df-45b2-88c2-553f244699d3...

    Hi All

    With a lot of help from Ken and Dimitry I got my end result but not as expected.  I have a “multi-tier event structure” that captures the NewInspector event, which in turn sets up the capture for the inspector_activate event, which in turn sets up the capture for the item_reply event.  Ken and Dimitry got me passed the needed code construction in the activate event using the RDOMail object that effects a copy of the original “current item” to an RDOMail reflection in the drafts folder.  I am ultimately trying to change the “to/recipient” data based upon an address contained in the original message body.  In my original set up of the “reply” event prior to exit from the activate event I used the following line of code

    Set insReply = objSmail.item

    Where insReply is the defined name of the Reply event and objSmail.item is the redemption mailitem.  This construct works.

    The following code was introduced to create a copy of an RDOmailitem in the drafts folder to allow me to set that infamous “to” field to the desired address when the Reply function is selected/displayed.

        Dim sss As RDOSession

       Dim rdoMlItm As RDOMail

        Dim rdoMlItm2 As RDOMail

        Dim rdoFldr As RDOFolder

        Dim rdoitms As RDOItems

        Set sss = CreateObject("Redemption.RDOSession")

        sss.MAPIOBJECT = Application.Session.MAPIOBJECT

        Set rdoMlItm = sss.GetRDOObjectFromOutlookObject(objSmail)

        Set rdoFldr = sss.GetDefaultFolder(olFolderDrafts)

        Set rdoitms = rdoFldr.Items

        Set rdoMlItm2 = rdoitms.Add(olMailItem)

        rdoMlItm.CopyTo rdoMlItm2

        rdoMlItm2.To = variable address

        rdoMlItm2.Save

       Set insReply = rdoMlItem2  (item is not part of this construct)

    The above construct does NOT work – Type Mismatch.  Is the RDOMail item not a mailitem object?  I got around this problem by simply using the first construct to “activate the Reply event” and then reacquired rdoMlItm2 by use of its entryid in the Reply event.  I was then presented with the deeper question of what “data” set does the “default Reply Form” display?  I was thinking since I set the rdoMlItm2 object to the “working object” that this was now the “current.item” and therefore this would be the object passed to the display method that displays the default Reply form.  Not the case – I am not sure what “data set” it was using”.  In order to get my variable address to show in the “to” field of the Reply Form I had to do a rdoMlItm2.display followed by a cancel to stop the default reply form from being presented next.  I repeat my question:  What “Object” data set does the default Reply form display – the current.item I assume.  And if this is the case how do you predict what the current.item will be when the default Reply form is displayed?  Or any form for that matter!

    Besides the questions above here are the other questions that are really perplexing me.

      •      In recap: Can I set up the Reply event object to the rdoMlItm2 object?
      •      If I can do this, is the insReply.to data going to be equal to the rdoMlItm2.to data?
      •      Is Outlook then going to display the “insReply” object data in the Reply form?
      •      Is the “Response” passed object/parameter in the Reply event the Object that is passed to the “Application Itemsend” event?

    Thanks again to Ken and Dimitry for helping me get this app working (in spite of myself) but there are still a number of clouds blocking “my enlightenment”.

    Respectfully,

    Gordon Haas


    Gordon Haas


    Ken Slovak MVP - Outlook
    Friday, August 31, 2012 7:28 PM
    Moderator
  • If you reply to an Outlook MailItem, or call the Reply() method on an Outlook mail item the Reply() event's Response object is the new mail item being created as the reply. It is an incoming parameter that provides a handle to the new Outlook MailItem.
     
    The new Response item has no EntryID property until it's saved. If I wanted a handle to the new reply item as an RDOMail object (before it was saved) I'd probably use the RDOSession.GetRDOObjectFromOutlookObject() method, passing in the Response object or a MailItem object cast from the Response object.
     
    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "saahg" <=?utf-8?B?c2FhaGc=?=> wrote in message news:ff6747d7-16d1-445d-a8a1-e2b20d6c415b...

    Sorry Ken for the lack of response but I have been "on the road" for the last 12 days.  I got your responses and I am digesting them currently.  The one question that you did not understand is my way of asking what is the function of the "passed response" object in the "reply" event handler?  Is this incoming or outgoing?

    Respectfully,

    Gordon Haas

     

    Gordon Haas


    Ken Slovak MVP - Outlook
    • Marked as answer by saahg Thursday, September 13, 2012 2:12 PM
    Wednesday, September 12, 2012 3:34 PM
    Moderator

All replies

  • You can't set an RDOMail item to an Outlook MailItem or vice versa. One is an Outlook object and the other is an object representing a MAPI IMessage. That's even though they both depict the same object and set of data.
     
    To go back and forth you must get the id's (EntryID and StoreID) and use the correct method for the object type (NameSpace.GetItemFromID or RDOSession.GetMessageFromID).
     
    When reply is clicked on an item, whether in an Inspector or an Explorer, the reply item that gets opened is an Outlook MailItem object. If reply is clicked in an Outlook item in an Inspector the reply is based on Inspector.CurrentItem. If it's in an Explorer then each item in Explorer.Selection is used as the basis for each reply.
     
    •      In recap: Can I set up the Reply event object to the rdoMlItm2 object?
    If the user is clicking Reply on an Outlook item an Outlook reply item will be created. If you call the Reply() method on an RDOMail item using code an RDOMail item is created as the reply. Make sure to save the original RDOMail item before calling Reply() though.
    •      If I can do this, is the insReply.to data going to be equal to the rdoMlItm2.to data?
    You can't do it unless code is used to create the reply item. If that is done the data in the RDOMail item is used to provision the reply item.
    •      Is Outlook then going to display the “insReply” object data in the Reply form?
    Not if the user clicks reply. If you do it in code and then display the RDOMail item you would see the RDOMail item. Why use code to set To though? I would use the Recipients collection myself, removing any I didn't want and adding those I wanted.
     
    I have handled reply items opening where I closed the original item and replaced it with one I wanted shown, the down side is a flicker in the UI often can be seen.
    •      Is the “Response” passed object/parameter in the Reply event the Object that is passed to the “Application Itemsend” event?
    I don't understand this question, please explain.
     
    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "saahg" <=?utf-8?B?c2FhaGc=?=> wrote in message news:dfff4143-d4df-45b2-88c2-553f244699d3...

    Hi All

    With a lot of help from Ken and Dimitry I got my end result but not as expected.  I have a “multi-tier event structure” that captures the NewInspector event, which in turn sets up the capture for the inspector_activate event, which in turn sets up the capture for the item_reply event.  Ken and Dimitry got me passed the needed code construction in the activate event using the RDOMail object that effects a copy of the original “current item” to an RDOMail reflection in the drafts folder.  I am ultimately trying to change the “to/recipient” data based upon an address contained in the original message body.  In my original set up of the “reply” event prior to exit from the activate event I used the following line of code

    Set insReply = objSmail.item

    Where insReply is the defined name of the Reply event and objSmail.item is the redemption mailitem.  This construct works.

    The following code was introduced to create a copy of an RDOmailitem in the drafts folder to allow me to set that infamous “to” field to the desired address when the Reply function is selected/displayed.

        Dim sss As RDOSession

       Dim rdoMlItm As RDOMail

        Dim rdoMlItm2 As RDOMail

        Dim rdoFldr As RDOFolder

        Dim rdoitms As RDOItems

        Set sss = CreateObject("Redemption.RDOSession")

        sss.MAPIOBJECT = Application.Session.MAPIOBJECT

        Set rdoMlItm = sss.GetRDOObjectFromOutlookObject(objSmail)

        Set rdoFldr = sss.GetDefaultFolder(olFolderDrafts)

        Set rdoitms = rdoFldr.Items

        Set rdoMlItm2 = rdoitms.Add(olMailItem)

        rdoMlItm.CopyTo rdoMlItm2

        rdoMlItm2.To = variable address

        rdoMlItm2.Save

       Set insReply = rdoMlItem2  (item is not part of this construct)

    The above construct does NOT work – Type Mismatch.  Is the RDOMail item not a mailitem object?  I got around this problem by simply using the first construct to “activate the Reply event” and then reacquired rdoMlItm2 by use of its entryid in the Reply event.  I was then presented with the deeper question of what “data” set does the “default Reply Form” display?  I was thinking since I set the rdoMlItm2 object to the “working object” that this was now the “current.item” and therefore this would be the object passed to the display method that displays the default Reply form.  Not the case – I am not sure what “data set” it was using”.  In order to get my variable address to show in the “to” field of the Reply Form I had to do a rdoMlItm2.display followed by a cancel to stop the default reply form from being presented next.  I repeat my question:  What “Object” data set does the default Reply form display – the current.item I assume.  And if this is the case how do you predict what the current.item will be when the default Reply form is displayed?  Or any form for that matter!

    Besides the questions above here are the other questions that are really perplexing me.

      •      In recap: Can I set up the Reply event object to the rdoMlItm2 object?
      •      If I can do this, is the insReply.to data going to be equal to the rdoMlItm2.to data?
      •      Is Outlook then going to display the “insReply” object data in the Reply form?
      •      Is the “Response” passed object/parameter in the Reply event the Object that is passed to the “Application Itemsend” event?

    Thanks again to Ken and Dimitry for helping me get this app working (in spite of myself) but there are still a number of clouds blocking “my enlightenment”.

    Respectfully,

    Gordon Haas


    Gordon Haas


    Ken Slovak MVP - Outlook
    Friday, August 31, 2012 7:28 PM
    Moderator
  • Sorry Ken for the lack of response but I have been "on the road" for the last 12 days.  I got your responses and I am digesting them currently.  The one question that you did not understand is my way of asking what is the function of the "passed response" object in the "reply" event handler?  Is this incoming or outgoing?

    Respectfully,

    Gordon Haas

     

    Gordon Haas

    Tuesday, September 11, 2012 9:24 PM
  • If you reply to an Outlook MailItem, or call the Reply() method on an Outlook mail item the Reply() event's Response object is the new mail item being created as the reply. It is an incoming parameter that provides a handle to the new Outlook MailItem.
     
    The new Response item has no EntryID property until it's saved. If I wanted a handle to the new reply item as an RDOMail object (before it was saved) I'd probably use the RDOSession.GetRDOObjectFromOutlookObject() method, passing in the Response object or a MailItem object cast from the Response object.
     
    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "saahg" <=?utf-8?B?c2FhaGc=?=> wrote in message news:ff6747d7-16d1-445d-a8a1-e2b20d6c415b...

    Sorry Ken for the lack of response but I have been "on the road" for the last 12 days.  I got your responses and I am digesting them currently.  The one question that you did not understand is my way of asking what is the function of the "passed response" object in the "reply" event handler?  Is this incoming or outgoing?

    Respectfully,

    Gordon Haas

     

    Gordon Haas


    Ken Slovak MVP - Outlook
    • Marked as answer by saahg Thursday, September 13, 2012 2:12 PM
    Wednesday, September 12, 2012 3:34 PM
    Moderator
  • Thanks Ken for the insights.  As always learned a lot but realize have a lot more to learn.

    Respectfully,

    Gordon Haas


    Gordon Haas

    Thursday, September 13, 2012 2:16 PM