-----Original Message-----
From: Herold Heiko [mailto:[EMAIL PROTECTED]]
Posted At: Tuesday, February 18, 2003 10:13 AM
Posted To: perl-win32-admin
Conversation: Ole CDO woes
Subject: RE: Ole CDO woesThe incantation of LDAP currently is not one of my proficiencies, although I'm planning to learn it ASAP (but not now).CDO is a object model present in Exchange 5.5 server (and so usable on the server itself, without any mapi client like outlook installed), it was even a downloadable module for outlook 97. From outlook 2k (I think) it is included as a standard, but not installed by default.The documentation for the cdo model is available on msdn ator athttp://www.cdolive.com/cdo.htm (get cdo.zip)Although that site isn't updated any more it still contains lots of good info and working sample code.I'm suspecting the fields being not deletable once created, and the ..="" not working due to some conversion problem (one of the OLE areas I'm not understanding yet completely is the working of the Variant datatypes and the relative conversions).Currently I have a whole application working correctly except this issue, so starting from scratch in order to convert the whole thing to LDAP wouldn't be the best thing :(Thanks anywayHeiko--
-- PREVINET S.p.A. [EMAIL PROTECTED]
-- Via Ferretto, 1 ph x39-041-5907073
-- I-31021 Mogliano V.to (TV) fax x39-041-5907472
-- ITALY-----Original Message-----
From: Steven Manross [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 18, 2003 4:55 PM
To: 'Herold Heiko'; List Perl-Win32-Admin (E-mail)
Subject: RE: Ole CDO woesHave you looked at doing this through LDAP?
I'm not sure what docs you were looking at, but I believe the CDO model is for Exchange 2000 (though I've never seen code to change Exchange fax and phone numbers through MAPI).
Win32::Exchange has a working example for you to set properties in Exchange 5.5 and 2000, but you'd be talking to the Exchange Server through LDAP instead of MAPI. Deleting those attributes for those properties would basically be as easy as setting them to "".
Win32::Exchange can be found on CPAN (http://search.cpan.org/author/SMANROSS/Win32-Exchange_v0.032/) or on Dave Roth's PPM site http://www.roth.net/perl/packages/
I'd be interested in seeing the source of your documentation on your MAPI approach if you don't mind.
Steven
-----Original Message-----
From: Herold Heiko [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 18, 2003 8:14 AM
To: List Perl-Win32-Admin (E-mail)
Subject: Ole CDO woes
I'm trying to update a bunch of mailboxes in a exchange server environment
(5.5sp2) via Win32::OLE and CDO ("MAPI.Session").
For some mailboxes I need to change the existing fax and phone number (CdoPR_BUSINESS_TELEPHONE_NUMBER and CdoPR_PRIMARY_FAX_NUMBER). Everything working ok with this:my $addrentries = $gal->AddressEntries;
my $addrentry = $addrentries->GetFirst;
my $fields = $addrentry->{Fields};
< match the correct addrentries by
$fields->Item($cdoconst->{CdoPR_OBJECT_TYPE})->{Value} and
$fields->Item($cdoconst->{CdoPR_TRANSMITABLE_DISPLAY_NAME_A})->{Value} >$fields->Item($cdoconst->{CdoPR_BUSINESS_TELEPHONE_NUMBER})->{Value} = $newnumber; $addrentry->Update;
For some other mailboxes I need to delete those fields. From the docs I expected this to work: $fields->Item($cdoconst->{CdoPR_BUSINESS_TELEPHONE_NUMBER})->Delete;
$fields->Item($cdoconst->{CdoPR_PRIMARY_FAX_NUMBER})->Delete;
$addrentry->Update;With that I get (right after the Delete) a
DB<3> x Win32::OLE->LastError()
0 'OLE exception from "Collaboration Data Objects":[Collaboration Data Objects - [E_ACCESSDENIED(80070005)]]
Win32::OLE(0.1008) error 0x80070005: "Access is denied"
in METHOD/PROPERTYGET "Delete"'The account used for the (explicit) logon definitively has rights, I even tried the service account After all changing those numbers does work, too. On the other hand, trying to clean the fields instead of deleting them:
$fields->Item($cdoconst->{CdoPR_BUSINESS_TELEPHONE_NUMBER})->{Value} = ""; $addrentry->Update;
will give me an error in Update:
0 'OLE exception from "Collaboration Data Objects":
You do not have sufficient permission to perform this operation on this object. [Microsoft Exchange Address Book - [E_ACCESSDENIED(80070005)]]
Win32::OLE(0.1008) error 0x80070005: "Access is denied"
in METHOD/PROPERTYGET "Update"'Same thing if I try to set those phone number fields to something nonsensical like "abcd". On the other hand, from exchange administrator I can empty those fields fine, I can even create a fresh mailbox without anything in those fields - in that case the cdo fields collection won't even contain a field for CdoPR_BUSINESS_TELEPHONE_NUMBER!
Any idea ?
Heiko Herold
--
-- PREVINET S.p.A. [EMAIL PROTECTED]
-- Via Ferretto, 1 ph x39-041-5907073
-- I-31021 Mogliano V.to (TV) fax x39-041-5907472
-- ITALY
_______________________________________________
Perl-Win32-Admin mailing list [EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Title: RE: Ole CDO woes
I
agree with Steven. Doing this via ADSI is much easier. CDO 1.21,
which is what you get on Exchange 5.5 just didn't have the directory mechanisms
in it that you really need. You can post a question about CDO 1.21 on one
of the microsoft public newsgroups and Sigfried, who runs CDOLive, may well
respond with the answer though.
CDO
1.21 is a client oriented MAPI based protocol (the CDO objects wrap MAPI
calls). All the other incarnations of CDO (CDONT, CDOEX, CDOEXM, CDOWF,
etc) are non-MAPI based server side object models.
To
further complicate the story, Exchange 5.5 Admin uses DAPI to update the
directory, not LDAP or ADSI or CDO or MAPI. Not all properties that can be
written in DAPI can be written in MAPI or even in LDAP/ADSI.
- Ole CDO woes Herold Heiko
- RE: Ole CDO woes Steven Manross
- RE: Ole CDO woes Herold Heiko
- RE: Ole CDO woes Herold Heiko
- RE: Ole CDO woes Webb, Andy
- RE: Ole CDO woes Herold Heiko
