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

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