|
|
|
date: Fri, 8 Feb 2008 09:53:46 -0800 (PST),
group: microsoft.public.office.developer.outlook.vba
back
VBA .Move or .Copy Resets All Properties
Hi,
I need to move files from one folder to another in an Exchange account
and I thought Outlook VBA would be the simplest solution, but I can't
seem to figure out where I've gone wrong.
Every time I do a .Copy or a .Move on the MailItem object, the item's
properties seem to reset and act as if it's an unsent message.
I've simplified my code to just a single item copy to the same folder:
--------------------
Dim objNameSpace As Outlook.NameSpace
Dim objSourceFolder as MAPIFolder
Dim strEntryID As String
strEntryID = <my folder>
Set objNameSpace = Outlook.Session
Set objSourceFolder = objNameSpace.GetFolderFromID(strEntryID)
objSourceFolder.Items(1).Copy
--------------------
This does not copy the message, but instead seems to make a new,
unsent message with the from, to, and subject filled in. The icon for
the message looks like a sent message though.
I've been scouring forums and groups and saw mention of having
to .Save after the .Copy
For example:
Set objNewMailItem = objSourceFolder.Items(1).Copy
Set objNewMailItem =
Outlook.Application.GetNamespace("MAPI").GetItemFromID(objNewMailItem.EntryID)
objNewMailItem.Save
That doesn't do anything different than the above simple .Copy.
So what am I doing wrong.
I want to be able to replicate the Edit->Copy (and Edit->Cut), Edit-
Paste functionality of Outlook. I tried playing with Redemption and
that doesn't seem to do anything different with its CopyTo. I have not
tried the Redemption RDOs though.
I would appreciate any help, I'm so lost because I remember doing this
years ago in Outlook 2000 with something as simple as the above.
Thank you,
David
date: Fri, 8 Feb 2008 09:53:46 -0800 (PST)
author: unknown
Re: VBA .Move or .Copy Resets All Properties
RDOMail.Move/CopyTo will preserve all the properties.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
wrote in message
news:dab6b025-c264-469d-94c5-29ae6f78d83b@m34g2000hsf.googlegroups.com...
> Hi,
>
> I need to move files from one folder to another in an Exchange account
> and I thought Outlook VBA would be the simplest solution, but I can't
> seem to figure out where I've gone wrong.
>
> Every time I do a .Copy or a .Move on the MailItem object, the item's
> properties seem to reset and act as if it's an unsent message.
>
> I've simplified my code to just a single item copy to the same folder:
>
> --------------------
> Dim objNameSpace As Outlook.NameSpace
> Dim objSourceFolder as MAPIFolder
>
> Dim strEntryID As String
> strEntryID = <my folder>
>
> Set objNameSpace = Outlook.Session
>
> Set objSourceFolder = objNameSpace.GetFolderFromID(strEntryID)
>
> objSourceFolder.Items(1).Copy
> --------------------
>
> This does not copy the message, but instead seems to make a new,
> unsent message with the from, to, and subject filled in. The icon for
> the message looks like a sent message though.
>
> I've been scouring forums and groups and saw mention of having
> to .Save after the .Copy
>
> For example:
>
> Set objNewMailItem = objSourceFolder.Items(1).Copy
> Set objNewMailItem =
> Outlook.Application.GetNamespace("MAPI").GetItemFromID(objNewMailItem.EntryID)
> objNewMailItem.Save
>
> That doesn't do anything different than the above simple .Copy.
>
> So what am I doing wrong.
>
> I want to be able to replicate the Edit->Copy (and Edit->Cut), Edit-
> Paste functionality of Outlook. I tried playing with Redemption and
> that doesn't seem to do anything different with its CopyTo. I have not
> tried the Redemption RDOs though.
>
> I would appreciate any help, I'm so lost because I remember doing this
> years ago in Outlook 2000 with something as simple as the above.
>
> Thank you,
> David
date: Sat, 9 Feb 2008 16:31:25 -0700
author: Dmitry Streblechenko
Re: VBA .Move or .Copy Resets All Properties
It took me a few days to figure it all out, but I have it working
perfectly now. Thank you very much.
Incidentally, if I use MAPITable.Columns to choose only the
LastModificationTime, will that affect the MoveTo/CopyTo from copying
all properties? It doesn't seem like it in my testing, but it's hard
to tell.
David
On Feb 9, 3:31 pm, "Dmitry Streblechenko" wrote:
> RDOMail.Move/CopyTo will preserve all the properties.
>
> Dmitry Streblechenko (MVP)http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> wrote in message
>
> news:dab6b025-c264-469d-94c5-29ae6f78d83b@m34g2000hsf.googlegroups.com...
>
> > Hi,
>
> > I need to move files from one folder to another in an Exchange account
> > and I thought Outlook VBA would be the simplest solution, but I can't
> > seem to figure out where I've gone wrong.
>
> > Every time I do a .Copy or a .Move on the MailItem object, the item's
> > properties seem to reset and act as if it's an unsent message.
>
> > I've simplified my code to just a single item copy to the same folder:
>
> > --------------------
> > Dim objNameSpace As Outlook.NameSpace
> > Dim objSourceFolder as MAPIFolder
>
> > Dim strEntryID As String
> > strEntryID = <my folder>
>
> > Set objNameSpace = Outlook.Session
>
> > Set objSourceFolder = objNameSpace.GetFolderFromID(strEntryID)
>
> > objSourceFolder.Items(1).Copy
> > --------------------
>
> > This does not copy the message, but instead seems to make a new,
> > unsent message with the from, to, and subject filled in. The icon for
> > the message looks like a sent message though.
>
> > I've been scouring forums and groups and saw mention of having
> > to .Save after the .Copy
>
> > For example:
>
> > Set objNewMailItem = objSourceFolder.Items(1).Copy
> > Set objNewMailItem =
> > Outlook.Application.GetNamespace("MAPI").GetItemFromID(objNewMailItem.Entry ID)
> > objNewMailItem.Save
>
> > That doesn't do anything different than the above simple .Copy.
>
> > So what am I doing wrong.
>
> > I want to be able to replicate the Edit->Copy (and Edit->Cut), Edit-
> > Paste functionality of Outlook. I tried playing with Redemption and
> > that doesn't seem to do anything different with its CopyTo. I have not
> > tried the Redemption RDOs though.
>
> > I would appreciate any help, I'm so lost because I remember doing this
> > years ago in Outlook 2000 with something as simple as the above.
>
> > Thank you,
> > David
date: Thu, 14 Feb 2008 01:28:36 -0800 (PST)
author: unknown
Re: VBA .Move or .Copy Resets All Properties
Nope. The two do not affect each other at all.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
wrote in message
news:bd4af412-4f96-4bca-99a5-4588bf908d6e@e30g2000hsa.googlegroups.com...
It took me a few days to figure it all out, but I have it working
perfectly now. Thank you very much.
Incidentally, if I use MAPITable.Columns to choose only the
LastModificationTime, will that affect the MoveTo/CopyTo from copying
all properties? It doesn't seem like it in my testing, but it's hard
to tell.
David
On Feb 9, 3:31 pm, "Dmitry Streblechenko" wrote:
> RDOMail.Move/CopyTo will preserve all the properties.
>
> Dmitry Streblechenko (MVP)http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> wrote in message
>
> news:dab6b025-c264-469d-94c5-29ae6f78d83b@m34g2000hsf.googlegroups.com...
>
> > Hi,
>
> > I need to move files from one folder to another in an Exchange account
> > and I thought Outlook VBA would be the simplest solution, but I can't
> > seem to figure out where I've gone wrong.
>
> > Every time I do a .Copy or a .Move on the MailItem object, the item's
> > properties seem to reset and act as if it's an unsent message.
>
> > I've simplified my code to just a single item copy to the same folder:
>
> > --------------------
> > Dim objNameSpace As Outlook.NameSpace
> > Dim objSourceFolder as MAPIFolder
>
> > Dim strEntryID As String
> > strEntryID = <my folder>
>
> > Set objNameSpace = Outlook.Session
>
> > Set objSourceFolder = objNameSpace.GetFolderFromID(strEntryID)
>
> > objSourceFolder.Items(1).Copy
> > --------------------
>
> > This does not copy the message, but instead seems to make a new,
> > unsent message with the from, to, and subject filled in. The icon for
> > the message looks like a sent message though.
>
> > I've been scouring forums and groups and saw mention of having
> > to .Save after the .Copy
>
> > For example:
>
> > Set objNewMailItem = objSourceFolder.Items(1).Copy
> > Set objNewMailItem =
> > Outlook.Application.GetNamespace("MAPI").GetItemFromID(objNewMailItem.Entry
> > ID)
> > objNewMailItem.Save
>
> > That doesn't do anything different than the above simple .Copy.
>
> > So what am I doing wrong.
>
> > I want to be able to replicate the Edit->Copy (and Edit->Cut), Edit-
> > Paste functionality of Outlook. I tried playing with Redemption and
> > that doesn't seem to do anything different with its CopyTo. I have not
> > tried the Redemption RDOs though.
>
> > I would appreciate any help, I'm so lost because I remember doing this
> > years ago in Outlook 2000 with something as simple as the above.
>
> > Thank you,
> > David
date: Thu, 14 Feb 2008 15:01:26 -0700
author: Dmitry Streblechenko
Re: VBA .Move or .Copy Resets All Properties
Thank you again. Only about 50GB more to copy...
On Feb 14, 2:01 pm, "Dmitry Streblechenko" wrote:
> Nope. The two do not affect each other at all.
>
> Dmitry Streblechenko (MVP)http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> wrote in message
>
> news:bd4af412-4f96-4bca-99a5-4588bf908d6e@e30g2000hsa.googlegroups.com...
> It took me a few days to figure it all out, but I have it working
> perfectly now. Thank you very much.
>
> Incidentally, if I use MAPITable.Columns to choose only the
> LastModificationTime, will that affect the MoveTo/CopyTo from copying
> all properties? It doesn't seem like it in my testing, but it's hard
> to tell.
>
> David
>
> On Feb 9, 3:31 pm, "Dmitry Streblechenko" wrote:
>
> > RDOMail.Move/CopyTo will preserve all the properties.
>
> > Dmitry Streblechenko (MVP)http://www.dimastr.com/
> > OutlookSpy - Outlook, CDO
> > and MAPI Developer Tool
>
> > wrote in message
>
> >news:dab6b025-c264-469d-94c5-29ae6f78d83b@m34g2000hsf.googlegroups.com...> > > Hi,
>
> > > I need to move files from one folder to another in an Exchange account> > > and I thought Outlook VBA would be the simplest solution, but I can't
> > > seem to figure out where I've gone wrong.
>
> > > Every time I do a .Copy or a .Move on the MailItem object, the item's
> > > properties seem to reset and act as if it's an unsent message.
>
> > > I've simplified my code to just a single item copy to the same folder:> > > Dim objNameSpace As Outlook.NameSpace
> > > Dim objSourceFolder as MAPIFolder
>
> > > Dim strEntryID As String
> > > strEntryID = <my folder>
>
> > > Set objNameSpace = Outlook.Session
>
> > > Set objSourceFolder = objNameSpace.GetFolderFromID(strEntryID)
>
> > > objSourceFolder.Items(1).Copy
> > > --------------------
>
> > > This does not copy the message, but instead seems to make a new,
> > > unsent message with the from, to, and subject filled in. The icon for
> > > the message looks like a sent message though.
>
> > > I've been scouring forums and groups and saw mention of having
> > > to .Save after the .Copy
>
> > > For example:
>
> > > Set objNewMailItem = objSourceFolder.Items(1).Copy
> > > Set objNewMailItem =
> > > Outlook.Application.GetNamespace("MAPI").GetItemFromID(objNewMailItem.Entry
> > > ID)
> > > objNewMailItem.Save
>
> > > That doesn't do anything different than the above simple .Copy.
>
> > > So what am I doing wrong.
>
> > > I want to be able to replicate the Edit->Copy (and Edit->Cut), Edit-
> > > Paste functionality of Outlook. I tried playing with Redemption and
> > > that doesn't seem to do anything different with its CopyTo. I have not> > > tried the Redemption RDOs though.
>
> > > I would appreciate any help, I'm so lost because I remember doing this> > > years ago in Outlook 2000 with something as simple as the above.
>
> > > Thank you,
> > > David
date: Thu, 14 Feb 2008 16:37:47 -0800 (PST)
author: unknown
Re: VBA .Move or .Copy Resets All Properties
Do you happen to have the code as an example. I to am trying to properly
implement the replacement of the standard .move command with the RDOMail.move
command.
"hozan.saito@gmail.com" wrote:
> It took me a few days to figure it all out, but I have it working
> perfectly now. Thank you very much.
>
> Incidentally, if I use MAPITable.Columns to choose only the
> LastModificationTime, will that affect the MoveTo/CopyTo from copying
> all properties? It doesn't seem like it in my testing, but it's hard
> to tell.
>
> David
>
> On Feb 9, 3:31 pm, "Dmitry Streblechenko" wrote:
> > RDOMail.Move/CopyTo will preserve all the properties.
> >
> > Dmitry Streblechenko (MVP)http://www.dimastr.com/
> > OutlookSpy - Outlook, CDO
> > and MAPI Developer Tool
> >
> > wrote in message
> >
> > news:dab6b025-c264-469d-94c5-29ae6f78d83b@m34g2000hsf.googlegroups.com...
> >
> > > Hi,
> >
> > > I need to move files from one folder to another in an Exchange account
> > > and I thought Outlook VBA would be the simplest solution, but I can't
> > > seem to figure out where I've gone wrong.
> >
> > > Every time I do a .Copy or a .Move on the MailItem object, the item's
> > > properties seem to reset and act as if it's an unsent message.
> >
> > > I've simplified my code to just a single item copy to the same folder:
> >
> > > --------------------
> > > Dim objNameSpace As Outlook.NameSpace
> > > Dim objSourceFolder as MAPIFolder
> >
> > > Dim strEntryID As String
> > > strEntryID = <my folder>
> >
> > > Set objNameSpace = Outlook.Session
> >
> > > Set objSourceFolder = objNameSpace.GetFolderFromID(strEntryID)
> >
> > > objSourceFolder.Items(1).Copy
> > > --------------------
> >
> > > This does not copy the message, but instead seems to make a new,
> > > unsent message with the from, to, and subject filled in. The icon for
> > > the message looks like a sent message though.
> >
> > > I've been scouring forums and groups and saw mention of having
> > > to .Save after the .Copy
> >
> > > For example:
> >
> > > Set objNewMailItem = objSourceFolder.Items(1).Copy
> > > Set objNewMailItem =
> > > Outlook.Application.GetNamespace("MAPI").GetItemFromID(objNewMailItem.Entry ID)
> > > objNewMailItem.Save
> >
> > > That doesn't do anything different than the above simple .Copy.
> >
> > > So what am I doing wrong.
> >
> > > I want to be able to replicate the Edit->Copy (and Edit->Cut), Edit-
> > > Paste functionality of Outlook. I tried playing with Redemption and
> > > that doesn't seem to do anything different with its CopyTo. I have not
> > > tried the Redemption RDOs though.
> >
> > > I would appreciate any help, I'm so lost because I remember doing this
> > > years ago in Outlook 2000 with something as simple as the above.
> >
> > > Thank you,
> > > David
>
>
date: Sat, 1 Mar 2008 12:07:00 -0800
author: David T.
Re: VBA .Move or .Copy Resets All Properties
set Msg = Msg.Move(SomeRDOFolder)
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"David T." wrote in message
news:DFC5A6AF-B250-41BE-9551-113B98CFC22E@microsoft.com...
> Do you happen to have the code as an example. I to am trying to properly
> implement the replacement of the standard .move command with the
> RDOMail.move
> command.
>
> "hozan.saito@gmail.com" wrote:
>
>> It took me a few days to figure it all out, but I have it working
>> perfectly now. Thank you very much.
>>
>> Incidentally, if I use MAPITable.Columns to choose only the
>> LastModificationTime, will that affect the MoveTo/CopyTo from copying
>> all properties? It doesn't seem like it in my testing, but it's hard
>> to tell.
>>
>> David
>>
>> On Feb 9, 3:31 pm, "Dmitry Streblechenko" wrote:
>> > RDOMail.Move/CopyTo will preserve all the properties.
>> >
>> > Dmitry Streblechenko (MVP)http://www.dimastr.com/
>> > OutlookSpy - Outlook, CDO
>> > and MAPI Developer Tool
>> >
>> > wrote in message
>> >
>> > news:dab6b025-c264-469d-94c5-29ae6f78d83b@m34g2000hsf.googlegroups.com...
>> >
>> > > Hi,
>> >
>> > > I need to move files from one folder to another in an Exchange
>> > > account
>> > > and I thought Outlook VBA would be the simplest solution, but I can't
>> > > seem to figure out where I've gone wrong.
>> >
>> > > Every time I do a .Copy or a .Move on the MailItem object, the item's
>> > > properties seem to reset and act as if it's an unsent message.
>> >
>> > > I've simplified my code to just a single item copy to the same
>> > > folder:
>> >
>> > > --------------------
>> > > Dim objNameSpace As Outlook.NameSpace
>> > > Dim objSourceFolder as MAPIFolder
>> >
>> > > Dim strEntryID As String
>> > > strEntryID = <my folder>
>> >
>> > > Set objNameSpace = Outlook.Session
>> >
>> > > Set objSourceFolder = objNameSpace.GetFolderFromID(strEntryID)
>> >
>> > > objSourceFolder.Items(1).Copy
>> > > --------------------
>> >
>> > > This does not copy the message, but instead seems to make a new,
>> > > unsent message with the from, to, and subject filled in. The icon for
>> > > the message looks like a sent message though.
>> >
>> > > I've been scouring forums and groups and saw mention of having
>> > > to .Save after the .Copy
>> >
>> > > For example:
>> >
>> > > Set objNewMailItem = objSourceFolder.Items(1).Copy
>> > > Set objNewMailItem =
>> > > Outlook.Application.GetNamespace("MAPI").GetItemFromID(objNewMailItem.Entry
>> > > ID)
>> > > objNewMailItem.Save
>> >
>> > > That doesn't do anything different than the above simple .Copy.
>> >
>> > > So what am I doing wrong.
>> >
>> > > I want to be able to replicate the Edit->Copy (and Edit->Cut), Edit-
>> > > Paste functionality of Outlook. I tried playing with Redemption and
>> > > that doesn't seem to do anything different with its CopyTo. I have
>> > > not
>> > > tried the Redemption RDOs though.
>> >
>> > > I would appreciate any help, I'm so lost because I remember doing
>> > > this
>> > > years ago in Outlook 2000 with something as simple as the above.
>> >
>> > > Thank you,
>> > > David
>>
>>
date: Tue, 4 Mar 2008 13:38:02 -0700
author: Dmitry Streblechenko
|
|