PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook Form Programming Keep changed UserProperties when moving to different folder

Reply

Keep changed UserProperties when moving to different folder

 
Thread Tools Rate Thread
Old 12-06-2006, 10:07 AM   #1
Stefan Singer
Guest
 
Posts: n/a
Default Keep changed UserProperties when moving to different folder


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
  Reply With Quote
Old 12-06-2006, 12:47 PM   #2
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: Keep changed UserProperties when moving to different folder

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

  Reply With Quote
Old 12-06-2006, 05:47 PM   #3
Stefan Singer
Guest
 
Posts: n/a
Default Re: Keep changed UserProperties when moving to different folder

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).
  Reply With Quote
Old 12-06-2006, 07:04 PM   #4
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: Keep changed UserProperties when moving to different folder

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

  Reply With Quote
Old 13-06-2006, 07:00 AM   #5
Stefan Singer
Guest
 
Posts: n/a
Default Re: Keep changed UserProperties when moving to different folder

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
  Reply With Quote
Old 13-06-2006, 12:25 PM   #6
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: Keep changed UserProperties when moving to different folder

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

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

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