[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Add an Entry with ADSI in C++



> I'm trying to create an entry of class 'person' in an OpenLDAP directory
> using ADSI.
> I could not figure out why this is not working since the only required
> attribute is 'sn'.
> Here is my code :
>
> HRESULT hr;
> IADsContainer *pCont = NULL;
> IADs *pADs = NULL;
> IDispatch *pDisp = NULL;
> CoInitialize(NULL);
> hr =
> ADsOpenObject(L"LDAP://192.168.3.118/dc=rtetest,dc=org",L"cn=administrat
> eur,dc=rtetest,dc=org", L"rtekb", 0, IID_IADsContainer,(void**)&pCont);
> hr = pCont->Create(CComBSTR("person"), CComBSTR("cn=JeffSmith"),
> &pDisp);
> hr = pDisp->QueryInterface(IID_IADs, (void**) &pADs);
> hr = pADs->Put(CComBSTR("sn"), CComVariant("JeffSmith"));
> hr = pADs->SetInfo(); // Error  0x80072014 the requested operation did
> not satisfy one or more contraints associated with the object
>
>
> Any help appreciated

I suggest you carefully read the schema for objectClass person; you'll
find out that "sn" is not the only required attribute; at least one more
is explicitly required ("cn"), and another one is implicitly required; I'm
not familiar with ADSI syntax, so I don't know if you're already adding
it.

I suggest you ask ADSI specific fori for more specific info.

p.

-- 
Pierangelo Masarati
mailto:pierangelo.masarati@sys-net.it




    SysNet - via Dossi,8 27100 Pavia Tel: +390382573859 Fax: +390382476497