none
Accessing a Form Region RRS feed

  • Question

  • I am syncing appointments from an external Database into Outlook, my Appointment Item also has a Form Region.  I am using UserProperties to save the Data to.  I then need these values to show in my Form, which I populate using the following code in the Form Region Showing Event

    txtOwner.Text = thisAppointment.UserProperties.Add("oOwner", UPT.olText, false, UPT.olText).Value

    My issue is, if this is the first time my appointment has been opened after being synced updating txtOwner.Text Triggers the change event and tells outlook that the appointment now needs saving.

    I would like to update this textbox value when performing the Sync as I don't want any mods happening, unless an actual change is taking place.

    Can you access the Form Region from the ThisAddIn.cs area.

    Thanks

    Tuesday, November 13, 2012 4:46 PM

Answers

  • Do not call UserProperties.Add.

    Call UserProperties.Item("oOwner"):

    UserProperty prop = thisAppointment.UserProperties.Item("oOwner"):
    if (prop != null)
    {
       txtOwner.Text = prop.Value;
    }
    else
    {
       txtOwner.Text = "";
    }


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!


    Tuesday, November 13, 2012 8:21 PM
  • This hasn't helped at all, any change to the text box in Form Region showing is triggering the mod.  It is nothing to do with the user properties, is there a hook-in to the Form Region from the ThisAddIn.cs page, or can I amend the

    (Outlook.AppointmentItem)this.OutlookItem.Saved;

    back to true even though it isn't?

    essentially I do not want to update the

    (Outlook.Application)this.OutlookItem.LastModificationTime

    Wednesday, November 14, 2012 10:21 AM

All replies

  • Do not call UserProperties.Add.

    Call UserProperties.Item("oOwner"):

    UserProperty prop = thisAppointment.UserProperties.Item("oOwner"):
    if (prop != null)
    {
       txtOwner.Text = prop.Value;
    }
    else
    {
       txtOwner.Text = "";
    }


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!


    Tuesday, November 13, 2012 8:21 PM
  • You're adding the User Property which doesn't update the text value for your form object.

    You can try Dmitry's sample code or you can use this instead:

    Dim oUserProp as Outlook.UserProperty
    oUserProp = thisAppointment.UserProperties.Find("oOwner")
    If TypeName(oUserProp) <> "Nothing" Then
       txtOwner.Text = oUserProp.Value.ToString
    End If


    • Edited by Khem Oco Wednesday, November 14, 2012 2:32 AM
    Wednesday, November 14, 2012 2:25 AM
  • Dmitry,

    Thank you for your help, I will implement this, I did originally do it like this but was told on these Forums that I was better off using Add, but I can see now why this would be an issue.


    I was told, that Add was better as it worked the same as find but had the benefit of adding the property if it doesn't exist.
    • Edited by Vis Xero Wednesday, November 14, 2012 9:45 AM
    Wednesday, November 14, 2012 9:43 AM
  • This hasn't helped at all, any change to the text box in Form Region showing is triggering the mod.  It is nothing to do with the user properties, is there a hook-in to the Form Region from the ThisAddIn.cs page, or can I amend the

    (Outlook.AppointmentItem)this.OutlookItem.Saved;

    back to true even though it isn't?

    essentially I do not want to update the

    (Outlook.Application)this.OutlookItem.LastModificationTime

    Wednesday, November 14, 2012 10:21 AM
  • Can you add the rest of the code and explain further what you're trying to accomplish?
    Thursday, November 15, 2012 12:48 AM