More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

forum 21-Jan-2017 10:04

Looking for help with Outlook programming projects — VSTO, add-ins, VBA, custom Outlook forms, etc.? You′ve come to the right place!

NEW! >> Subscribe to this site via RSS. For more RSS options, see the complete list of feeds on our main news page.

    Page [ 1 2 Next >> ]  
 Outlook Form Design Printer Friendly Version
Designing custom Outlook forms and form regions and writing code for them
Topic
task Item.UserProperties("Cc") changing after creating a message object
Outlook 2000 on Win 2000, custom task form. My form sends an email to the TO list and CC list when the form is save/closed. It does this with a
set objApp = CreateObject("Outlook.Applicatio")
set objMsg = objApp.CreateItem(olmaiItem) ' 0
It then sets objMsg.cc to Item.UserProperties("Cc"), but this does NOT include any changes made to the CC list since opening the task item. If I save Item.UserProperties("Cc") before entering this subroutine, and use the saved copy, it picks up the full current cc list.

Can anyone please tell me what I'm missing?

Thanks,
Dan

  08-Jun-2004  08:39
  08-Jun-2004  08:57   
Changes made to a property through a form control are not committed to the underlying item until the user either moves the focus to another control or saves the item. So a relevant issue might be -- *how* does the user make changes to the Cc property?
  08-Jun-2004  11:56   
The user makes the change by clicking the normal To/Cc button and selecting a name from the GAL.

I do nothing with it until the user does the save/close.

I always see the change OK if I copy it BEFORE doing the message createobject and createitem, but the change always gets lost AFTER doing the message createobject and createitem.

This is all public folder stuff by the way .

I've tried changing the Cc and save/closing straight away, and I've tried clicking elsewhere before the save/close. It makes no difference.

If this makes no sense then I must have another glitch that I'm not seeing, but everything seems to be working fine now that I take a copy of the task's Cc list before creating my email message.

Thanks!
Dan
  08-Jun-2004  12:17   
But where is the value of a Cc custom property coming from, as in Item.UserProperties("Cc")?
  08-Jun-2004  13:02   
From the Outlook Cc field...which I now see is a mail field, not a task field, though I have it on a task form. I originally had the To field, to record who owned the task, then we added a Cc field for others who needed to be aware of the task. When I select either of these (or rather, the control that is bound to them), the email GAL picker comes up.

Should I be using Item.Cc instead of Item.UserProperties("Cc")?

Probably I still don't understand your question....
  08-Jun-2004  13:54   
If you look on the All Field tab, do you see a Cc field under User-defined Fields?
  08-Jun-2004  14:46   
No, not under User-defined fields.

I see it under All Mail fields
  08-Jun-2004  17:08   
Yeah, this has led me to discover something very curious. If you can successfully add a property from another type of item to a custom form (and that's a big IF), Outlook automatically creates a corresponding UserProperty. It does not, however, behave like a normal UserProperty, because it doesn't fire a CustomPropertyChanged event. You've pointed out another oddity of this type of property -- a value change may not commit when you expect it to.

In your case, the correct property to use would be Item.StatusUpdateRecipients.

TIP: You can use code like this anytime you're trying to determine what's going on with your properties:

Sub Item_CustomPropertyChange(ByVal Name)
    MsgBox Name & " - " & Item.UserProperties.Item(Name).Value,, "Custom"
End Sub

Sub Item_PropertyChange(ByVal Name)
   ' use this version for Outlook 2002/3
    ' MsgBox Name & " - " & Item.ItemProperties.Item(Name).Value,, "Built-in"
    ' otherwise use this version
    MsgBox Name
End Sub
  08-Jun-2004  17:36   
FYI, I've updated the page at http://www.outlookcode.com/d/propsyntax.htm to include information on this little oddity.
  04-Jul-2008  03:00   
Hi, I'm customizing my outlook form to capture some data that the user selects from DDL's etc, once the user clicks send the data is captured/logged in a textbox, I have tested this code and added it to the Function Item_Send(), when the recipient receives the email, the textbox loses that value. Icant seem to figure why that is, I'm using the script editor within Outlook.

Would someone be able to give me some advice or assist me..
  04-Jul-2008  08:48   
Shara, because your issue is not related to the current discussion topic, please start a new topic using the Add New link on the right side of the page at http://www.outlookcode.net/messages.aspx?forumid=3 .
    Page [ 1 2 Next >> ]