Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
IADsNameTranslate Interface
The IADsNameTranslate interface is used to translate distinguished names between various formats. Name translations are performed on the directory server, and this interface is currently available only to objects in Active Directory.
The following code example converts an account name from Windows format into LDAP format.
HRESULT TranslateNTNameToLDAPName( BSTR * pNTName, BSTR * pLDAPName )
{
IADsNameTranslate *pTrans;
HRESULT hr = S_OK;
hr = CoCreateInstance(CLSID_NameTranslate,
NULL,
CLSCTX_INPROC_SERVER,
IID_IADsNameTranslate,
(void**) &pTrans );
if (FAILED(hr)) { return hr; }
hr = pTrans->Init(ADS_NAME_INITTYPE_DOMAIN,
CComBSTR("Fabrikam.com"));
if (FAILED(hr)) { return hr; }
hr = pTrans->Set(ADS_NAME_TYPE_NT4, *pNTName);
if (FAILED(hr)) { return hr; }
hr = pTrans->Get(ADS_NAME_TYPE_1779, pLDAPName);
pTrans->Release();
return hr;
}
Feedback
Was this page helpful?
