
folder userproperty - outlook 2000/2002
Hiya
I'm working with user-defined fields.
I know if you create a user-defined field in a mail item
the default behaviour is for this field to also be created
in the folder.
But I am having trouble doing this in the folder I want as
any newly created item seems to exist in the inbox or
drafts folder. If I move my mailitem to a new folder
before adding the userproperties they don't seem to stick
while I'm still holding on to the object reference. It
might work if I move it to the said folder ,set the object
to nothing and then set the object reference again with
the item now in the correct folder.
I also found this script from Sue - but I can't seem to
get it to work, although the script executes quite
happily. objDummy doesn't exist or have any properties. ??
Sub MakeUserPropsInFolder()
Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objInsp As Outlook.Inspector
Dim objFld As Outlook.MAPIFolder
Dim objItem As Object
Dim objProp As Outlook.UserProperty
Dim objDummy As Object
On Error Resume Next
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
Set objFld = objNS.PickFolder
If Not objFld Is Nothing Then
Set objInsp = Application.ActiveInspector
If Not objInsp Is Nothing Then
Set objItem = objInsp.CurrentItem
Set objDummy = objFld.Items.Add
For Each objProp In objItem.UserProperties
MsgBox objProp.Name
objDummy.UserProperties.Add objProp.Name,
objProp.Type
If Err Then
Debug.Print Err, Err.Description
Err.Clear
End If
Next
End If
End If
Set objDummy = Nothing
Set objItem = Nothing
Set objProp = Nothing
Set objFld = Nothing
Set objInsp = Nothing
Set objNS = Nothing
Set objOL = Nothing
End Sub
Also the object browser model doesn't show any
userproperty values for MAPIfolders.
I was wondering is there any code based way of creating
these user properties in a folder? I ask as I'm using
Set myMailItem = myDestFolder.Items.Find(querystring)
using the userdefined fields in the query string
cheers for any help
Nomit