Home All Groups Group Topic Archive Search About

unexpected behaviour: mailitem.save and attachment

Author
4 Feb 2005 11:17 AM
giovanni
Hello everyone,
I found a strange behaviour in .save method applied to a mailitem object.
here's my scenario:
Outlook2003, a macro that tracks current explorer movements and selections.
When explorer hoops onto a received mail it adds a custom action "myAction",
with the goal of catch the relative event _customaction.
Everything run fine till someone noticed this behaviour:
Well when I try to forward a mailitem with an attachment (for example
"myattach.pdf") it forward it but the attachment is somewhere modified and
renamed as winmail.dat and then the receiving client can't see the original
attachment at all.
Has anyone an idea?
--
TIA Giovanni

Author
4 Feb 2005 1:23 PM
Sue Mosher [MVP-Outlook]
The presence of Winmail.dat indicates that the message has changed format to
rich-text. I suspect this is a side-effect from the custom action technique
that you're using. Since custom actions are a feature of Outlook form
design, adding one to an item on the fly is equivalent to embedding a custom
form design in the message item. Both create rich-text content, even if the
message format isn't RTF, and that results in the Winmail.dat file.

--
Sue Mosher, Outlook MVP
Author of
     Microsoft Outlook Programming - Jumpstart for
     Administrators, Power Users, and Developers
     http://www.outlookcode.com/jumpstart.aspx


Show quote
"giovanni" <giova***@discussions.microsoft.com> wrote in message
news:3B2EFE89-A11F-4EB9-A70C-76C67B43644A@microsoft.com...
> Hello everyone,
> I found a strange behaviour in .save method applied to a mailitem object.
> here's my scenario:
> Outlook2003, a macro that tracks current explorer movements and
> selections.
> When explorer hoops onto a received mail it adds a custom action
> "myAction",
> with the goal of catch the relative event _customaction.
> Everything run fine till someone noticed this behaviour:
> Well when I try to forward a mailitem with an attachment (for example
> "myattach.pdf") it forward it but the attachment is somewhere modified and
> renamed as winmail.dat and then the receiving client can't see the
> original
> attachment at all.
> Has anyone an idea?
> --
> TIA Giovanni
Author
4 Feb 2005 2:11 PM
giovanni
Hi Sue, first of all thankU for support. I suspected what You wrote, but
there's a way You know to prevent or to override this effect? It's important
for me to keep using custom action. One more consideration: I tried my macros
on an OLK2000 and it doesn't generate such a problem, so it seemes due only
to OLK2003.

Show quote
"Sue Mosher [MVP-Outlook]" wrote:

> The presence of Winmail.dat indicates that the message has changed format to
> rich-text. I suspect this is a side-effect from the custom action technique
> that you're using. Since custom actions are a feature of Outlook form
> design, adding one to an item on the fly is equivalent to embedding a custom
> form design in the message item. Both create rich-text content, even if the
> message format isn't RTF, and that results in the Winmail.dat file.
>
> --
> Sue Mosher, Outlook MVP
> Author of
>      Microsoft Outlook Programming - Jumpstart for
>      Administrators, Power Users, and Developers
>      http://www.outlookcode.com/jumpstart.aspx
>
>
> "giovanni" <giova***@discussions.microsoft.com> wrote in message
> news:3B2EFE89-A11F-4EB9-A70C-76C67B43644A@microsoft.com...
> > Hello everyone,
> > I found a strange behaviour in .save method applied to a mailitem object.
> > here's my scenario:
> > Outlook2003, a macro that tracks current explorer movements and
> > selections.
> > When explorer hoops onto a received mail it adds a custom action
> > "myAction",
> > with the goal of catch the relative event _customaction.
> > Everything run fine till someone noticed this behaviour:
> > Well when I try to forward a mailitem with an attachment (for example
> > "myattach.pdf") it forward it but the attachment is somewhere modified and
> > renamed as winmail.dat and then the receiving client can't see the
> > original
> > attachment at all.
> > Has anyone an idea?
> > --
> > TIA Giovanni
>
>
>
Author
4 Feb 2005 2:25 PM
Sue Mosher [MVP-Outlook]
The only approach I can think of would be to use code in the
Application.ItemSend method to try to detect the presence of the one-off
form in the outgoing message and strip it with CDO using the technique
demonstrated in the sample at
http://www.cdolive.net/download/CleanUpOneOff.zip

--
Sue Mosher, Outlook MVP
Author of
     Microsoft Outlook Programming - Jumpstart for
     Administrators, Power Users, and Developers
     http://www.outlookcode.com/jumpstart.aspx


Show quote
"giovanni" <giova***@discussions.microsoft.com> wrote in message
news:0B1E3B0E-BD27-4B45-8DD7-1129178332BE@microsoft.com...
> Hi Sue, first of all thankU for support. I suspected what You wrote, but
> there's a way You know to prevent or to override this effect? It's
> important
> for me to keep using custom action. One more consideration: I tried my
> macros
> on an OLK2000 and it doesn't generate such a problem, so it seemes due
> only
> to OLK2003.
>
> "Sue Mosher [MVP-Outlook]" wrote:
>
>> The presence of Winmail.dat indicates that the message has changed format
>> to
>> rich-text. I suspect this is a side-effect from the custom action
>> technique
>> that you're using. Since custom actions are a feature of Outlook form
>> design, adding one to an item on the fly is equivalent to embedding a
>> custom
>> form design in the message item. Both create rich-text content, even if
>> the
>> message format isn't RTF, and that results in the Winmail.dat file.
>>
>>
>> "giovanni" <giova***@discussions.microsoft.com> wrote in message
>> news:3B2EFE89-A11F-4EB9-A70C-76C67B43644A@microsoft.com...
>> > Hello everyone,
>> > I found a strange behaviour in .save method applied to a mailitem
>> > object.
>> > here's my scenario:
>> > Outlook2003, a macro that tracks current explorer movements and
>> > selections.
>> > When explorer hoops onto a received mail it adds a custom action
>> > "myAction",
>> > with the goal of catch the relative event _customaction.
>> > Everything run fine till someone noticed this behaviour:
>> > Well when I try to forward a mailitem with an attachment (for example
>> > "myattach.pdf") it forward it but the attachment is somewhere modified
>> > and
>> > renamed as winmail.dat and then the receiving client can't see the
>> > original
>> > attachment at all.
>> > Has anyone an idea?
Author
7 Feb 2005 10:03 AM
giovanni
Hi Sue, I tried to use CDO as you suggested, but there are some problems:
1) the applicationItemSend gives me an "Item" object that's a MailItem
object, which can't be set = to a MAPI.Message object, that is the object to
be cleaned via CDO: how can I convert the Item to MAPI.Message?
2)trying to workaround the problem above I tried to search the item in the
selected folder, or in the "OutBox" Folder but in the first it doesen't
appear in it and the second I wasn't able to find out.
3)I tried to remove the CustomAction before forwarding the message but it
didn't strip out the RTF format, moreover I tried the thing in an Outlook2000
installation of my code and it works fine even if a don't strip out the
customaction I added, so do you think the "side effect" is somehow a bug in
OLK2003?
again: thanks 4 unbelievable support.

Show quote
"Sue Mosher [MVP-Outlook]" wrote:

> The only approach I can think of would be to use code in the
> Application.ItemSend method to try to detect the presence of the one-off
> form in the outgoing message and strip it with CDO using the technique
> demonstrated in the sample at
> http://www.cdolive.net/download/CleanUpOneOff.zip
>
> --
> Sue Mosher, Outlook MVP
> Author of
>      Microsoft Outlook Programming - Jumpstart for
>      Administrators, Power Users, and Developers
>      http://www.outlookcode.com/jumpstart.aspx
>
>
> "giovanni" <giova***@discussions.microsoft.com> wrote in message
> news:0B1E3B0E-BD27-4B45-8DD7-1129178332BE@microsoft.com...
> > Hi Sue, first of all thankU for support. I suspected what You wrote, but
> > there's a way You know to prevent or to override this effect? It's
> > important
> > for me to keep using custom action. One more consideration: I tried my
> > macros
> > on an OLK2000 and it doesn't generate such a problem, so it seemes due
> > only
> > to OLK2003.
> >
> > "Sue Mosher [MVP-Outlook]" wrote:
> >
> >> The presence of Winmail.dat indicates that the message has changed format
> >> to
> >> rich-text. I suspect this is a side-effect from the custom action
> >> technique
> >> that you're using. Since custom actions are a feature of Outlook form
> >> design, adding one to an item on the fly is equivalent to embedding a
> >> custom
> >> form design in the message item. Both create rich-text content, even if
> >> the
> >> message format isn't RTF, and that results in the Winmail.dat file.
> >>
> >>
> >> "giovanni" <giova***@discussions.microsoft.com> wrote in message
> >> news:3B2EFE89-A11F-4EB9-A70C-76C67B43644A@microsoft.com...
> >> > Hello everyone,
> >> > I found a strange behaviour in .save method applied to a mailitem
> >> > object.
> >> > here's my scenario:
> >> > Outlook2003, a macro that tracks current explorer movements and
> >> > selections.
> >> > When explorer hoops onto a received mail it adds a custom action
> >> > "myAction",
> >> > with the goal of catch the relative event _customaction.
> >> > Everything run fine till someone noticed this behaviour:
> >> > Well when I try to forward a mailitem with an attachment (for example
> >> > "myattach.pdf") it forward it but the attachment is somewhere modified
> >> > and
> >> > renamed as winmail.dat and then the receiving client can't see the
> >> > original
> >> > attachment at all.
> >> > Has anyone an idea?
>
>
>
Author
7 Feb 2005 12:35 PM
Sue Mosher [MVP-Outlook]
1-2) Save the item. Get its EntryID and StoreID and use those with CDO's
Session.GetMessage method to return a CDO Message.

3) Show your code.
--
Sue Mosher, Outlook MVP
Author of
     Microsoft Outlook Programming - Jumpstart for
     Administrators, Power Users, and Developers
     http://www.outlookcode.com/jumpstart.aspx


Show quote
"giovanni" <giova***@discussions.microsoft.com> wrote in message
news:D02A021D-8C4D-4FFD-9BEC-A60C229C13E1@microsoft.com...
> Hi Sue, I tried to use CDO as you suggested, but there are some problems:
> 1) the applicationItemSend gives me an "Item" object that's a MailItem
> object, which can't be set = to a MAPI.Message object, that is the object
> to
> be cleaned via CDO: how can I convert the Item to MAPI.Message?
> 2)trying to workaround the problem above I tried to search the item in the
> selected folder, or in the "OutBox" Folder but in the first it doesen't
> appear in it and the second I wasn't able to find out.
> 3)I tried to remove the CustomAction before forwarding the message but it
> didn't strip out the RTF format, moreover I tried the thing in an
> Outlook2000
> installation of my code and it works fine even if a don't strip out the
> customaction I added, so do you think the "side effect" is somehow a bug
> in
> OLK2003?
> again: thanks 4 unbelievable support.
>
> "Sue Mosher [MVP-Outlook]" wrote:
>
>> The only approach I can think of would be to use code in the
>> Application.ItemSend method to try to detect the presence of the one-off
>> form in the outgoing message and strip it with CDO using the technique
>> demonstrated in the sample at
>> http://www.cdolive.net/download/CleanUpOneOff.zip
>>
>> "giovanni" <giova***@discussions.microsoft.com> wrote in message
>> news:0B1E3B0E-BD27-4B45-8DD7-1129178332BE@microsoft.com...
>> > Hi Sue, first of all thankU for support. I suspected what You wrote,
>> > but
>> > there's a way You know to prevent or to override this effect? It's
>> > important
>> > for me to keep using custom action. One more consideration: I tried my
>> > macros
>> > on an OLK2000 and it doesn't generate such a problem, so it seemes due
>> > only
>> > to OLK2003.
>> >
>> > "Sue Mosher [MVP-Outlook]" wrote:
>> >
>> >> The presence of Winmail.dat indicates that the message has changed
>> >> format
>> >> to
>> >> rich-text. I suspect this is a side-effect from the custom action
>> >> technique
>> >> that you're using. Since custom actions are a feature of Outlook form
>> >> design, adding one to an item on the fly is equivalent to embedding a
>> >> custom
>> >> form design in the message item. Both create rich-text content, even
>> >> if
>> >> the
>> >> message format isn't RTF, and that results in the Winmail.dat file.
>> >>
>> >>
>> >> "giovanni" <giova***@discussions.microsoft.com> wrote in message
>> >> news:3B2EFE89-A11F-4EB9-A70C-76C67B43644A@microsoft.com...
>> >> > Hello everyone,
>> >> > I found a strange behaviour in .save method applied to a mailitem
>> >> > object.
>> >> > here's my scenario:
>> >> > Outlook2003, a macro that tracks current explorer movements and
>> >> > selections.
>> >> > When explorer hoops onto a received mail it adds a custom action
>> >> > "myAction",
>> >> > with the goal of catch the relative event _customaction.
>> >> > Everything run fine till someone noticed this behaviour:
>> >> > Well when I try to forward a mailitem with an attachment (for
>> >> > example
>> >> > "myattach.pdf") it forward it but the attachment is somewhere
>> >> > modified
>> >> > and
>> >> > renamed as winmail.dat and then the receiving client can't see the
>> >> > original
>> >> > attachment at all.
>> >> > Has anyone an idea?
>>
>>
>>
Author
7 Feb 2005 3:21 PM
giovanni
Hi Sue,
for points 1) and 2) I finally was able to get EntryID and StoreID (from
olOutBoxFolder) but after I cleanup message, than whan I press "Send" button
on explorer (MSWord) I get an "unknown error in transfer message interface,
if errro persists than restart Outlook" (maybe not the same: I translated it
from Italian) and than the message can't be sent.
I tried this in application_ItemSend and even in _forward event a track.
some more suggestions?
3) here's my custom_action cleanup code:

        If m_objMail.Class = olMail Then
            Set objAction = m_objMail.Actions("MyAction")
            If Not (objAction Is Nothing) Then
                For idx = 1 To m_objMail.Actions.Count
                    If (m_objMail.Actions.Item(idx).Name = "MyAction") Then
                        Exit For
                    End If
                Next idx
                If  (idx > 0) Then
                    m_objMail.Actions.Remove (idx)
                    m_objMail.Save
                End If
            End If
        End If



Show quote
"Sue Mosher [MVP-Outlook]" wrote:

> 1-2) Save the item. Get its EntryID and StoreID and use those with CDO's
> Session.GetMessage method to return a CDO Message.
>
> 3) Show your code.
> --
> Sue Mosher, Outlook MVP
> Author of
>      Microsoft Outlook Programming - Jumpstart for
>      Administrators, Power Users, and Developers
>      http://www.outlookcode.com/jumpstart.aspx
>
>
> "giovanni" <giova***@discussions.microsoft.com> wrote in message
> news:D02A021D-8C4D-4FFD-9BEC-A60C229C13E1@microsoft.com...
> > Hi Sue, I tried to use CDO as you suggested, but there are some problems:
> > 1) the applicationItemSend gives me an "Item" object that's a MailItem
> > object, which can't be set = to a MAPI.Message object, that is the object
> > to
> > be cleaned via CDO: how can I convert the Item to MAPI.Message?
> > 2)trying to workaround the problem above I tried to search the item in the
> > selected folder, or in the "OutBox" Folder but in the first it doesen't
> > appear in it and the second I wasn't able to find out.
> > 3)I tried to remove the CustomAction before forwarding the message but it
> > didn't strip out the RTF format, moreover I tried the thing in an
> > Outlook2000
> > installation of my code and it works fine even if a don't strip out the
> > customaction I added, so do you think the "side effect" is somehow a bug
> > in
> > OLK2003?
> > again: thanks 4 unbelievable support.
> >
> > "Sue Mosher [MVP-Outlook]" wrote:
> >
> >> The only approach I can think of would be to use code in the
> >> Application.ItemSend method to try to detect the presence of the one-off
> >> form in the outgoing message and strip it with CDO using the technique
> >> demonstrated in the sample at
> >> http://www.cdolive.net/download/CleanUpOneOff.zip
> >>
> >> "giovanni" <giova***@discussions.microsoft.com> wrote in message
> >> news:0B1E3B0E-BD27-4B45-8DD7-1129178332BE@microsoft.com...
> >> > Hi Sue, first of all thankU for support. I suspected what You wrote,
> >> > but
> >> > there's a way You know to prevent or to override this effect? It's
> >> > important
> >> > for me to keep using custom action. One more consideration: I tried my
> >> > macros
> >> > on an OLK2000 and it doesn't generate such a problem, so it seemes due
> >> > only
> >> > to OLK2003.
> >> >
> >> > "Sue Mosher [MVP-Outlook]" wrote:
> >> >
> >> >> The presence of Winmail.dat indicates that the message has changed
> >> >> format
> >> >> to
> >> >> rich-text. I suspect this is a side-effect from the custom action
> >> >> technique
> >> >> that you're using. Since custom actions are a feature of Outlook form
> >> >> design, adding one to an item on the fly is equivalent to embedding a
> >> >> custom
> >> >> form design in the message item. Both create rich-text content, even
> >> >> if
> >> >> the
> >> >> message format isn't RTF, and that results in the Winmail.dat file.
> >> >>
> >> >>
> >> >> "giovanni" <giova***@discussions.microsoft.com> wrote in message
> >> >> news:3B2EFE89-A11F-4EB9-A70C-76C67B43644A@microsoft.com...
> >> >> > Hello everyone,
> >> >> > I found a strange behaviour in .save method applied to a mailitem
> >> >> > object.
> >> >> > here's my scenario:
> >> >> > Outlook2003, a macro that tracks current explorer movements and
> >> >> > selections.
> >> >> > When explorer hoops onto a received mail it adds a custom action
> >> >> > "myAction",
> >> >> > with the goal of catch the relative event _customaction.
> >> >> > Everything run fine till someone noticed this behaviour:
> >> >> > Well when I try to forward a mailitem with an attachment (for
> >> >> > example
> >> >> > "myattach.pdf") it forward it but the attachment is somewhere
> >> >> > modified
> >> >> > and
> >> >> > renamed as winmail.dat and then the receiving client can't see the
> >> >> > original
> >> >> > attachment at all.
> >> >> > Has anyone an idea?
> >>
> >>
> >>
>
>
>
Author
8 Feb 2005 9:31 AM
giovanni
Hi Sue, have you read my last post: CDO solution seems not work, 'cos
generates an error on Sending message interface, did you verify it? need some
test code?
Do you think side effect is an undocumented bug of Outlook2003, because in
Outlook2000 there's no RTF conversion?
Please do not foget this thread.
TIA Giovanni

Show quote
"Sue Mosher [MVP-Outlook]" wrote:

> 1-2) Save the item. Get its EntryID and StoreID and use those with CDO's
> Session.GetMessage method to return a CDO Message.
>
> 3) Show your code.
> --
> Sue Mosher, Outlook MVP
> Author of
>      Microsoft Outlook Programming - Jumpstart for
>      Administrators, Power Users, and Developers
>      http://www.outlookcode.com/jumpstart.aspx
>
>
> "giovanni" <giova***@discussions.microsoft.com> wrote in message
> news:D02A021D-8C4D-4FFD-9BEC-A60C229C13E1@microsoft.com...
> > Hi Sue, I tried to use CDO as you suggested, but there are some problems:
> > 1) the applicationItemSend gives me an "Item" object that's a MailItem
> > object, which can't be set = to a MAPI.Message object, that is the object
> > to
> > be cleaned via CDO: how can I convert the Item to MAPI.Message?
> > 2)trying to workaround the problem above I tried to search the item in the
> > selected folder, or in the "OutBox" Folder but in the first it doesen't
> > appear in it and the second I wasn't able to find out.
> > 3)I tried to remove the CustomAction before forwarding the message but it
> > didn't strip out the RTF format, moreover I tried the thing in an
> > Outlook2000
> > installation of my code and it works fine even if a don't strip out the
> > customaction I added, so do you think the "side effect" is somehow a bug
> > in
> > OLK2003?
> > again: thanks 4 unbelievable support.
> >
> > "Sue Mosher [MVP-Outlook]" wrote:
> >
> >> The only approach I can think of would be to use code in the
> >> Application.ItemSend method to try to detect the presence of the one-off
> >> form in the outgoing message and strip it with CDO using the technique
> >> demonstrated in the sample at
> >> http://www.cdolive.net/download/CleanUpOneOff.zip
> >>
> >> "giovanni" <giova***@discussions.microsoft.com> wrote in message
> >> news:0B1E3B0E-BD27-4B45-8DD7-1129178332BE@microsoft.com...
> >> > Hi Sue, first of all thankU for support. I suspected what You wrote,
> >> > but
> >> > there's a way You know to prevent or to override this effect? It's
> >> > important
> >> > for me to keep using custom action. One more consideration: I tried my
> >> > macros
> >> > on an OLK2000 and it doesn't generate such a problem, so it seemes due
> >> > only
> >> > to OLK2003.
> >> >
> >> > "Sue Mosher [MVP-Outlook]" wrote:
> >> >
> >> >> The presence of Winmail.dat indicates that the message has changed
> >> >> format
> >> >> to
> >> >> rich-text. I suspect this is a side-effect from the custom action
> >> >> technique
> >> >> that you're using. Since custom actions are a feature of Outlook form
> >> >> design, adding one to an item on the fly is equivalent to embedding a
> >> >> custom
> >> >> form design in the message item. Both create rich-text content, even
> >> >> if
> >> >> the
> >> >> message format isn't RTF, and that results in the Winmail.dat file.
> >> >>
> >> >>
> >> >> "giovanni" <giova***@discussions.microsoft.com> wrote in message
> >> >> news:3B2EFE89-A11F-4EB9-A70C-76C67B43644A@microsoft.com...
> >> >> > Hello everyone,
> >> >> > I found a strange behaviour in .save method applied to a mailitem
> >> >> > object.
> >> >> > here's my scenario:
> >> >> > Outlook2003, a macro that tracks current explorer movements and
> >> >> > selections.
> >> >> > When explorer hoops onto a received mail it adds a custom action
> >> >> > "myAction",
> >> >> > with the goal of catch the relative event _customaction.
> >> >> > Everything run fine till someone noticed this behaviour:
> >> >> > Well when I try to forward a mailitem with an attachment (for
> >> >> > example
> >> >> > "myattach.pdf") it forward it but the attachment is somewhere
> >> >> > modified
> >> >> > and
> >> >> > renamed as winmail.dat and then the receiving client can't see the
> >> >> > original
> >> >> > attachment at all.
> >> >> > Has anyone an idea?
> >>
> >>
> >>
>
>
>

AddThis Social Bookmark Button