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
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for