PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook Form Programming
Keep changed UserProperties when moving to different folder
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook Form Programming
Keep changed UserProperties when moving to different folder
![]() |
Keep changed UserProperties when moving to different folder |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Have you tried saving the item (Item.Save) before you move it?
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Stefan Singer" <lala@macnews.de> wrote in message news:eTqD$7fjGHA.4748@TK2MSFTNGP04.phx.gbl... > 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 |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Sue Mosher [MVP-Outlook] schrieb:
> Have you tried saving the item (Item.Save) before you move it? > Affirmative:-) Through Item.Save and Item.Close(0). |
|
|
|
#4 |
|
Guest
Posts: n/a
|
That's not what your code below does. Do you have other code?
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Stefan Singer" <lala@macnews.de> wrote in message news:eM5le$jjGHA.1640@TK2MSFTNGP02.phx.gbl... > Sue Mosher [MVP-Outlook] schrieb: >> Have you tried saving the item (Item.Save) before you move it? >> > Affirmative:-) Through Item.Save and Item.Close(0). "Stefan Singer" <lala@macnews.de> wrote in message news:eTqD$7fjGHA.4748@TK2MSFTNGP04.phx.gbl... > 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 |
|
|
|
#5 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#6 |
|
Guest
Posts: n/a
|
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 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Stefan Singer" <lala@macnews.de> wrote in message news:OAHsR4qjGHA.5036@TK2MSFTNGP04.phx.gbl... >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 |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

