Article View: borland.public.cppbuilder.nativeapi
Article #10349Create user account errors
From: Dan Schmidt
Date: Mon, 19 Apr 2004 21:37
Date: Mon, 19 Apr 2004 21:37
32 lines
1996 bytes
1996 bytes
I am writing a web service DLL that uses ADSI to create user accounts within
a domain. The DLL is always executed under a server specified account that
has Account Operator privileges. My code follows the methodology described
in the MSDN knowledge base:
ADsGetObject(WideString("LDAP..."), IID_IADsContainer, (void
**)&iadVarContainer);
iadVarContainer->Create(WideString("user"), WideString("CN=" +
strAccountName), &idspUser);
idspUser->QueryInterface(IID_IADsUser, (void **)&iadUser);
iadUser->Put(WideString("sAMAccountName"), Variant(strAccountName));
iadUser->Put(WideString("userPrincipalName"), Variant(strAccountName +
"@" + strServerDomain));
iadUser->SetInfo();
The SetInfo() method keeps returning a value of 0x8007202F
(LDAP_CONSTRAINT_VIOLATION).
I have confirmed that this is not a permissions problem because I have other
routines that use ADSI to edit and delete existing user accounts and these
routines work perfectly.
Could anyone tell me what why I would be able to edit and delete accounts,
but not create them? What am I missing?
Dan
Technical Details
Message-ID:
<408446a7$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,303dc63b15a9f87e,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-04-19 14:40:09 PST From: "Dan Schmidt" <dan.schmidt@zedisolutions.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Create user account errors Date: Mon, 19 Apr 2004 15:37:20 -0600 Lines: 34 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 139.142.33.20 Message-ID: <408446a7$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1082410663 139.142.33.20 (19 Apr 2004 14:37:43 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail