UserProperties issue

  • Thread starter Thread starter Craig Buchanan
  • Start date Start date
C

Craig Buchanan

I am trying to convert a MailItem to a ContactItem programatically and set
two user-defined properties. I do this by moving the MailItem to the
Contacts folder, then add the UDPs. While the UDPs appear to be added in the
code, the properties are not displayed when I view the UDFs for the contact
in Outlook. Here's the code:

Dim ci As Outlook.MailItem = mailItem.Copy
With ci
'move the mailItem to the Contacts folder, which creates a contact
..Move(Me.Destination)
'test for existence of UDP, create and populate if it doesn't exist
If .UserProperties.Item("User Property") Is Nothing Then
..UserProperties.Add("User Property", Outlook.OlUserPropertyType.olText, False)
..UserProperties.Item("User Property").Value = "my user property"
End If
'test for existence of UDP, create and populate if it doesn't exist
If .UserProperties.Item("Folder Property") Is Nothing Then
..UserProperties.Add("Folder Property", Outlook.OlUserPropertyType.olText,
True)
..UserProperties.Item("Folder Property").Value = "my folder property"
End If
'save changes
..Save()
End With

Thoughts are appreciated. Thanks.
 
Move is a function that returns a new item in object in the destination
folder, not a sub.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
Is there an async method that is called when the move() method has completed?

Thanks.
 
You will get an Items.ItemAdd event on teh target folder.
But what exactly are you trying to do? Move is a synchronous method, use it.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
Back
Top