CDO update method works W2K but not in NT4 
Author Message
 CDO update method works W2K but not in NT4

I've created the VBA script below to create the
PR_ATTACH_LONG_FILENAME on a faxed attachment (see my
previous post on 1/8/2003 "How to refresh MAPI
properties".  All is now well when I run the script as a
macro on my W2K machine running OL2K.  When I export the
BAS file and load it on a NT4WS machine running OL2K, the
script runs, the mail closes and opens, but the
PR_ATTACH_LONG_FILENAME isn't updated.  I cannot find an
error (I put a msgbox for Err.Number and Err.Description
after the .update without any success).  I can see that
the NT4WS machine has CDO 1.1 and the W2K machine has CDO
1.2.  Is CDO 1.1 buggy or am I missing something obvious?  
I've searched the newsgroup a dozen different ways but
cannot find a solution for this.

Please help.  I don't have that much more hair to pull
out.  I'll have to start on my co-irkers next!

O- Mike Pinter, Sr.

The Code:

==================================================

Public Const CdoPR_ATTACH_FILENAME = &H3704001E
Public Const CdoPR_ATTACH_LONG_FILENAME = &H3707001E

Public Sub TestAttachments()
Dim objMail         As MailItem
Dim strLongFileName As String
Dim strFileName     As String
Dim strEntryID      As String

Dim oCDO
'On Error Resume Next
Err.Clear
Set oCDO = CreateObject("MAPI.Session")
If Err.Number <> 0 Then
    MsgBox "CDO not available. Error was " &
Err.Description
Else
    MsgBox "CDO Version " & oCDO.Version
    Set oCDO = Nothing
End If

'  to run this, you might need the CDO references added to
the PC

'   start CDO session
    Set objSession = CreateObject("MAPI.Session")
    objSession.Logon "", "", False, False

'   get the current message
Set objMail = Application.ActiveInspector.CurrentItem

'   pass message to CDO
strEntryID = objMail.EntryID
strStoreID = objMail.Parent.StoreID
Set objCDOMsg = objSession.GetMessage(strEntryID,
strStoreID)

'   Navigate through all attachments and make Extended MAPI

If objCDOMsg.Attachments.Count <> 0 Then
    For Each oAttachment In objCDOMsg.Attachments
        'On Error Resume Next
        'strLongFileName = oAttachment.Fields.Item
(CdoPR_ATTACH_LONG_FILENAME)
        'If strLongFileName = "" Then
            strFileName = oAttachment.Fields.Item
(CdoPR_ATTACH_FILENAME)
            oAttachment.Fields.Add
CdoPR_ATTACH_LONG_FILENAME, "Faxed Order.TIF"
        'End If
    Next
End If

'   Very important to update the CDO Object before
closing!!
objCDOMsg.Update

objMail.Close olSave
strEntryID = objMail.EntryID
Set objMail = Nothing

'   get the current message

Set objMAPIMessage = objSession.GetMessage(strEntryID)
Set ol = GetObject("", "Outlook.Application")
Set olns = ol.GetNamespace("MAPI")
Set objMail = olns.GetItemFromID(objMAPIMessage.ID,
objMAPIMessage.StoreID)

objMail.Display False

End Sub



Mon, 04 Jul 2005 07:47:42 GMT  
 CDO update method works W2K but not in NT4

CDO 1.1 is known to be buggy. If at all possible update the CDO to
1.21.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm



Quote:
> I've created the VBA script below to create the
> PR_ATTACH_LONG_FILENAME on a faxed attachment (see my
> previous post on 1/8/2003 "How to refresh MAPI
> properties".  All is now well when I run the script as a
> macro on my W2K machine running OL2K.  When I export the
> BAS file and load it on a NT4WS machine running OL2K, the
> script runs, the mail closes and opens, but the
> PR_ATTACH_LONG_FILENAME isn't updated.  I cannot find an
> error (I put a msgbox for Err.Number and Err.Description
> after the .update without any success).  I can see that
> the NT4WS machine has CDO 1.1 and the W2K machine has CDO
> 1.2.  Is CDO 1.1 buggy or am I missing something obvious?
> I've searched the newsgroup a dozen different ways but
> cannot find a solution for this.

> Please help.  I don't have that much more hair to pull
> out.  I'll have to start on my co-irkers next!

> O- Mike Pinter, Sr.

> The Code:

> ==================================================

> Public Const CdoPR_ATTACH_FILENAME = &H3704001E
> Public Const CdoPR_ATTACH_LONG_FILENAME = &H3707001E

> Public Sub TestAttachments()
> Dim objMail         As MailItem
> Dim strLongFileName As String
> Dim strFileName     As String
> Dim strEntryID      As String

> Dim oCDO
> 'On Error Resume Next
> Err.Clear
> Set oCDO = CreateObject("MAPI.Session")
> If Err.Number <> 0 Then
>     MsgBox "CDO not available. Error was " &
> Err.Description
> Else
>     MsgBox "CDO Version " & oCDO.Version
>     Set oCDO = Nothing
> End If

> '  to run this, you might need the CDO references added to
> the PC

> '   start CDO session
>     Set objSession = CreateObject("MAPI.Session")
>     objSession.Logon "", "", False, False

> '   get the current message
> Set objMail = Application.ActiveInspector.CurrentItem

> '   pass message to CDO
> strEntryID = objMail.EntryID
> strStoreID = objMail.Parent.StoreID
> Set objCDOMsg = objSession.GetMessage(strEntryID,
> strStoreID)

> '   Navigate through all attachments and make Extended MAPI

> If objCDOMsg.Attachments.Count <> 0 Then
>     For Each oAttachment In objCDOMsg.Attachments
>         'On Error Resume Next
>         'strLongFileName = oAttachment.Fields.Item
> (CdoPR_ATTACH_LONG_FILENAME)
>         'If strLongFileName = "" Then
>             strFileName = oAttachment.Fields.Item
> (CdoPR_ATTACH_FILENAME)
>             oAttachment.Fields.Add
> CdoPR_ATTACH_LONG_FILENAME, "Faxed Order.TIF"
>         'End If
>     Next
> End If

> '   Very important to update the CDO Object before
> closing!!
> objCDOMsg.Update

> objMail.Close olSave
> strEntryID = objMail.EntryID
> Set objMail = Nothing

> '   get the current message

> Set objMAPIMessage = objSession.GetMessage(strEntryID)
> Set ol = GetObject("", "Outlook.Application")
> Set olns = ol.GetNamespace("MAPI")
> Set objMail = olns.GetItemFromID(objMAPIMessage.ID,
> objMAPIMessage.StoreID)

> objMail.Display False

> End Sub



Mon, 04 Jul 2005 22:29:15 GMT  
 CDO update method works W2K but not in NT4
I was afraid of that.  I'm in a bind here in that we
install all PCs with disk imaging and our PC Support group
is adamant about not re-installing Outlook 2000 "custom"
(read "with different installation options") on the
department PCs to get CDO updated.  I've read in the
newsgroup and seen in MS Knowledgebase that CDO 1.2 used
to be a seperate installation but is no longer available.  
Do I have any other choice for updating CDO?

I am desperate here.  If anyone has the old CDO 1.21
installation that is no longer available for download and
would be willing to FTP it to me, please e-mail me at

This is a patch I need to get 5 people up and running on
our new Document Management system and we're over 45 days
late on installation just because of this one problem!

Regards,
Mike Pinter, Sr.

Quote:
>-----Original Message-----
>CDO 1.1 is known to be buggy. If at all possible update
the CDO to
>1.21.

>--
>Ken Slovak
>[MVP - Outlook]
>http://www.slovaktech.com
>Lead Author, Professional Outlook 2000 Programming, Wrox
Press
>Lead Author, Beginning VB 6 Application Development, Wrox
Press
>Attachment Options
>http://www.slovaktech.com/attachmentoptions.htm
>Extended Reminders
>http://www.slovaktech.com/extendedreminders.htm



>> I've created the VBA script below to create the
>> PR_ATTACH_LONG_FILENAME on a faxed attachment (see my
>> previous post on 1/8/2003 "How to refresh MAPI
>> properties".  All is now well when I run the script as a
>> macro on my W2K machine running OL2K.  When I export the
>> BAS file and load it on a NT4WS machine running OL2K,
the
>> script runs, the mail closes and opens, but the
>> PR_ATTACH_LONG_FILENAME isn't updated.  I cannot find an
>> error (I put a msgbox for Err.Number and Err.Description
>> after the .update without any success).  I can see that
>> the NT4WS machine has CDO 1.1 and the W2K machine has
CDO
>> 1.2.  Is CDO 1.1 buggy or am I missing something
obvious?
>> I've searched the newsgroup a dozen different ways but
>> cannot find a solution for this.

>> Please help.  I don't have that much more hair to pull
>> out.  I'll have to start on my co-irkers next!

>> O- Mike Pinter, Sr.



Tue, 05 Jul 2005 22:29:35 GMT  
 CDO update method works W2K but not in NT4
It's illegal to distribute CDO.DLL, Microsoft no longer supports that
as a distributable object. You either have to install it as an option
from the Office CD's or you can write code that can demand load CDO,
but that also requires access to the Office CD's or to a network
install point. If you want to remain legal those are the only ways to
install CDO on a user's machine.

Randy Byrne has code in his ItemsCB COM addin sample that will demand
load CDO if it is not already installed. It's located on the Resources
page at www.microeye.com

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm



Quote:
> I was afraid of that.  I'm in a bind here in that we
> install all PCs with disk imaging and our PC Support group
> is adamant about not re-installing Outlook 2000 "custom"
> (read "with different installation options") on the
> department PCs to get CDO updated.  I've read in the
> newsgroup and seen in MS Knowledgebase that CDO 1.2 used
> to be a seperate installation but is no longer available.
> Do I have any other choice for updating CDO?

> I am desperate here.  If anyone has the old CDO 1.21
> installation that is no longer available for download and
> would be willing to FTP it to me, please e-mail me at

> This is a patch I need to get 5 people up and running on
> our new Document Management system and we're over 45 days
> late on installation just because of this one problem!

> Regards,
> Mike Pinter, Sr.



Tue, 05 Jul 2005 23:32:25 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. VB6 with ADO works fine on W2k not on Win NT4

2. Update method in VB6 not working properly

3. Update method not working

4. Update method not working

5. Update method in VB6 not working properly

6. Addnew and update method in ADOCE not working ?

7. GetComputerName not working on win95, works on NT4

8. CDO Update method errors

9. Works In XP But Not W2K?

10. Script not working after moving to W2K

11. RS not working after migration to W2K.

12. CDO is not working

 

 
Powered by phpBB® Forum Software