Keep changed UserProperties when moving to different folder

S

Stefan Singer

Hi,

I created a custom task-item which is published in several folders. The
form has a checkbox that is False by Default (same problem occurs with
other forms, there it is dropdown-menu with all the possible folder
names). Upon changing the value of this checkbox (i.e. the
UserProperty), the element should be moved (using item.move) to the
another folder. I use the CustomPropertyChange-Action to move the form:


Sub Item_CustomPropertyChange(ByVal cpName)
Select Case cpName
Case "ASF"
If Item.UserProperties(cpName)=-1 then
Set nFol = Me.Application.GetNamespace("MAPI")_ &
..Folders.Item("Öffentliche Ordner")
& .Folders.Item("Alle Öffentlichen Ordner") &
..Folders.Item("Glasreinigungsarchiv")
Item.Move(nfol)
Item.Close(0)
End IF
End Select
End Sub

It works fine so far as the element is indeed moved to the other folder.
However, in this other folder the element's UserProperty ASF is again
false! Same thing for the form with the dropdown menu: The value is
changed, say, to 'Archive', the element is moved to folder 'Archive',
btu there, the element has still it's old value. How can I store the new
value without opening the element again after it has moved?

Regards

Stefan
 
S

Sue Mosher [MVP-Outlook]

Have you tried saving the item (Item.Save) before you move it?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
S

Sue Mosher [MVP-Outlook]

That's not what your code below does. Do you have other code?
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
S

Stefan Singer

I just used the Item. Save temporarily till I found out that it didn't
do any good, then changed it back to Item.Close(0) (which should save it
anyway, right?). However, I changed it back to this:

Sub Item_CustomPropertyChange(ByVal cpName)
Select Case cpName
Case "KolonnenName"
Set nFol = Me.Application.GetNamespace("MAPI")._ &
Folders.Item("Öffentliche Ordner").Folders. Item("Alle Öffentlichen
Ordner").Folders._
& Item(CalName)
Item.Save
Item.Move(nfol)
Item.Save
Case "ASf"
If Item.UserProperties(cpName)=-1 then
Set nFol = Me.Application.GetNamespace("MAPI").
Folders.Item("Öffentliche Ordner").
Folders.Item("Alle Öffentlichen Ordner").
Folders.Item("Glasreinigungsarchiv")
Item.Close(0)
Item.Save
Item.Move(nfol)
MsgBox Item.UserProperties(cpName).Value
Item.Save
End IF
End Select
End Sub


In both cases, the field is set to the original value (i.e. before the
CustomPropertyChange-method was fired) in the copied element. Btw,
"KolonnenName" is a UserProperty determined by a combo box. The element
is copied into the right folder, however, in this folder it still
displays its original folder. I use
Item.UserProperties("KolonnenName")=Me.Parent.Name in the Item.OPen
Method as a workaround, but still...

Thanks,

Stefan
 
S

Sue Mosher [MVP-Outlook]

What kind of form is this -- message, contact, etc?

You might want to take a look at the sample form at http://www.outlookcode.com/d/forms/saveinfolder.htm. The way I've made this work is by making a copy of the original item and moving the copy, then discarding the original.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Top