I'm having a bit of a problem with a user creation script I'm working on.
As far as I can tell, everything is in order, but when I try to issue the
DataSource Save method after CreateMailbox, I get an error.
########### error text ###############
DataSource Save failed.
Error:
Error: OLE exception from "<Unknown Source>":
Caller requested write access to a read-only object.
Win32::OLE(0.15) error 0x80040e94
in METHOD/PROPERTYGET "Save"
########### error text ###############
The code is really quite simple at this point. (I've pulled the error
detection for legibility.)
########### code sample ###############
use Win32::OLE;
$test = "foo01";
$container = "cn=users";
$user = "cn=administrator,dc=PLATINUM,cn=admin";
$pass = "xxxxxxx";
# Connect to the container
$adsPath = "LDAP://FISH/$container,DC=Platinum,DC=swinc,DC=com";
$dso = Win32::OLE->GetObject("LDAP:");
$ou = $dso->OpenDSObject("$adsPath","$user","$pass",1);
# Create the user
$shadow = $ou->Create("User", "CN=$test");
$shadow->Put ("samAccountName", "$test");
$shadow->Put ("userPrincipalName", "$test\@platinum.swinc.com");
$shadow->Put ("userAccountControl", "512");
$shadow->Put ("displayName","$test");
$shadow->Put ("givenName","$test");
$shadow->Put ("sn","zzTest");
$shadow->SetInfo; # ok at this point - user exists and is enabled
# Mailbox Enable the user
$objPerson = Win32::OLE->new("CDO.Person");
$objURL = "LDAP://CN=$test,$container,DC=Platinum,DC=swinc,DC=com";
$objPerson->DataSource->Open("$objURL");
$objMailbox = $objPerson->GetInterface(IMailboxStore);
$strMDB = "CN=Mailbox Store (FISH)," .
"CN=First Storage Group," .
"CN=InformationStore," .
"CN=FISH," .
"CN=Servers," .
"CN=PLATINUM," .
"CN=Administrative Groups," .
"CN=swinc-dev," .
"CN=Microsoft Exchange," .
"CN=Services," .
"CN=Configuration," .
"DC=platinum,DC=swinc,DC=com";
$objMailbox->CreateMailbox($strMDB);
$objPerson->DataSource->Save(); # this fails
########### code sample ###############
Now, from the Platform SDK, I can see that the DataSource->Open *should* be
able to take additional parameters, one of which is the adModeReadWrite
enum. But I haven't been able to get this to work either with a null
connection value.
It seems odd that none of the code samples for creating users seem to
require the adModeReadWrite flag be set.
--
=======================================================
Andy Webb [EMAIL PROTECTED] www.swinc.com
Simpler-Webb, Inc. Austin, TX 512-322-0071
-- Way to go USPS Cycling Team and Lance Armstrong!! --
=======================================================
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin