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

Reply via email to