Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / November 2003

Tip: Looking for answers? Try searching our database.

Can't get SentOn property value for item in "Sent Items" folder

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rick Andrews - 27 Nov 2003 05:31 GMT
Hi,

I'm trying to archive old emails based on their SentOn, ReceivedTime, or CreationTime properties.  I can get the value for these properties for any item except the items in the "Sent Items" folder.  E.g., when I try to get the SentOn time, I get an error.

  ItemTime = MyItems(MyItems.Count).SentOn

Error: "Run-time error '-2147168452 (8004cf3c)':
        "Method 'SentOn' of object 'MailItem' failed.

In fact, I've found that very few mailitem properties work for me in the Sent Items folder.  E.g., "subject", "Class", "MessageClass" work, but To, SenderName, SentOn, ReceivedTime, CreationTime don't.

Once I get the date/time of the message, I'll be moving it to a location in a different PST based on that date/time.  Will I be able to move it ok?
Dmitry Streblechenko - 27 Nov 2003 07:48 GMT
Is this the code you are using?
ItemTime = MyItems(MyItems.Count).SentOn
It looks like you are casting an integer property (Items.Count) to an object
(MyItems?).

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

> Hi,
>
> I'm trying to archive old emails based on their SentOn, ReceivedTime, or CreationTime properties.  I can get the value for these properties for any
item except the items in the "Sent Items" folder.  E.g., when I try to get
the SentOn time, I get an error.

>    ItemTime = MyItems(MyItems.Count).SentOn
>
> Error: "Run-time error '-2147168452 (8004cf3c)':
>          "Method 'SentOn' of object 'MailItem' failed.
>
> In fact, I've found that very few mailitem properties work for me in the Sent Items folder.  E.g., "subject", "Class", "MessageClass" work, but To,
SenderName, SentOn, ReceivedTime, CreationTime don't.

> Once I get the date/time of the message, I'll be moving it to a location in a different PST based on that date/time.  Will I be able to move it ok?
Rick Andrews - 27 Nov 2003 21:36 GMT
Duh. :-)  Sorry about that.  ItemTime is a Date Variable.  MyItems is a collection of Items, i.e.

   Dim myItems As Outlook.Item
   Dim ItemTime As Dat

I've since found several other times where the SentOn property fails even though the item type is a "MailItem" that aren't in the Sent Items folder.  E.g., recall requests return that they are "MailItems"s, but if I query the SentOn date, I get the same error I reported earlier

Ric
   
    ----- Dmitry Streblechenko wrote: ----
   
    Is this the code you are using
    ItemTime = MyItems(MyItems.Count).SentO
    It looks like you are casting an integer property (Items.Count) to an objec
    (MyItems?)
   
    Dmitry Streblechenko (MVP
    http://www.dimastr.com
    OutlookSpy  - Outlook, CD
    and MAPI Developer Too
   
   
    "Rick Andrews" <anonymous@discussions.microsoft.com> wrote in messag
    news:31721F31-4617-4732-8541-3BC783AE026F@microsoft.com..
    > Hi
    >> I'm trying to archive old emails based on their SentOn, ReceivedTime, o
    CreationTime properties.  I can get the value for these properties for an
    item except the items in the "Sent Items" folder.  E.g., when I try to ge
    the SentOn time, I get an error
    >>    ItemTime = MyItems(MyItems.Count).SentO
    >> Error: "Run-time error '-2147168452 (8004cf3c)'
    >          "Method 'SentOn' of object 'MailItem' failed
    >> In fact, I've found that very few mailitem properties work for me in th
    Sent Items folder.  E.g., "subject", "Class", "MessageClass" work, but To
    SenderName, SentOn, ReceivedTime, CreationTime don't
    >> Once I get the date/time of the message, I'll be moving it to a locatio
    in a different PST based on that date/time.  Will I be able to move it ok
Dmitry Streblechenko - 27 Nov 2003 22:50 GMT
Can you see PR_CLIENT_SUBMIT_TIME and PR_MESSAGE_DELIVERY_TIME on these
messages using MdbView or OutlookSpy?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

> Duh. :-)  Sorry about that.  ItemTime is a Date Variable.  MyItems is a collection of Items, i.e.,
>
>     Dim myItems As Outlook.Items
>     Dim ItemTime As Date
>
> I've since found several other times where the SentOn property fails even though the item type is a "MailItem" that aren't in the Sent Items folder.
E.g., recall requests return that they are "MailItems"s, but if I query the
SentOn date, I get the same error I reported earlier.

> Rick
>
[quoted text clipped - 25 lines]
>      >> Once I get the date/time of the message, I'll be moving it to a location
>      in a different PST based on that date/time.  Will I be able to move it ok?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.