A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Problem with setting Outlook item userproperties



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old April 13th 06, 04:08 PM posted to microsoft.public.outlook.program_vba
KeithXP
external usenet poster
 
Posts: 3
Default Problem with setting Outlook item userproperties

I am trying to use the following code (downloaded from OutlookCode.com and
modified to suit my requirements) to move information from the built in User
fields to custom property fields. I have only altered the name of the form
to be used and the names of the custom fields.

On running the code I get:
Run-time error '-13179289555 (b1720005)':
Method 'UserProperties' of object 'ContactItem' failed

I am pretty inexperienced in VBA in general so haven't a clue what the
problem is. I did try the syntax

objItem.UserProperties("Hotels").value = objItem.User1

but received a similar error.

Any ideas?

thanks

Keith

----------------------------------------------------------------------------------

Sub ConvertFields()
Dim objApp As Application
Dim objNS As NameSpace
Dim objFolder As MAPIFolder
Dim objItems As Items
Dim objItem As Object

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = objNS.PickFolder
If Not objFolder Is Nothing Then
Set objItems = objFolder.Items
For Each objItem In objItems
' make sure you have a Contact item
If objItem.Class = olContact Then
' convert to your published custom form
objItem.MessageClass = "IPM.Contact.PRList"
' copy data to your custom fields
objItem.UserProperties("Hotels") = objItem.User1
objItem.UserProperties("Residential") = objItem.User2
objItem.UserProperties("Prop. Dev.") = objItem.User3
objItem.UserProperties("Gardens") = objItem.User4
objItem.UserProperties("Projects") = objItem.Department
'comment out following lines until code is working
'objItem.User1 = ""
'objItem.User2 = ""
'objItem.User3 = ""
'objItem.User4 = ""
objItem.Save
End If
Next
End If

Set objItems = Nothing
Set objItem = Nothing
Set objFolder = Nothing
Set objNS = Nothing
Set objApp = Nothing

End Sub



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem setting OE as defaul mail client Jim Pickering Outlook Express 0 April 4th 06 09:22 PM
Problem with calendar item & Outlook 2003 Andreas Koepke Outlook - General Queries 1 March 17th 06 10:40 AM
Problem setting up Outlook Joanne Mills Outlook - Installation 2 March 11th 06 01:37 PM
VB.net Cannot add userproperties Ben Add-ins for Outlook 2 February 24th 06 11:32 AM
Userproperties in Folder MClaudio Outlook and VBA 3 January 16th 06 08:59 AM


All times are GMT +1. The time now is 06:11 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.