这是一个简单的code MSDN中删除的对象,如用户,... 但是,当我使用这个例子 这条线pOps-> DeleteObject(0);结果为E_ACCESSDENIED为什么? 请你帮我
IADsContainer * pCont;
LPWSTR Active Directory路径= LLDAP:// OU =销售额,DC = Fabrikam目录,DC = COM;
HRESULT HR = ADsGetObject(Active Directory路径,IID_IADsContainer,(无效**)及pCont);
如果(失败(小时))出口(小时);
IADsDeleteOps *持久性有机污染物;
HR = pCont->的QueryInterface(IID_IADsDeleteOps,(无效**)及持久性有机污染物);
pCont->发行();
如果(失败(小时)出口(小时);
pOps-> DeleteObject(0);
持久性有机污染物释放();
解决方案
您使用的是执行的动作没有权限删除目标对象的帐户。
this is a sample code in MSDN for deleting an object such as user , ... but when i am using this example this line "pOps->DeleteObject(0);" result is "E_ACCESSDENIED" why ? would you please help me
IADsContainer *pCont;
LPWSTR adsPath = L"LDAP://OU=Sales,DC=Fabrikam,DC=com";
HRESULT hr = ADsGetObject(adsPath,IID_IADsContainer,(void**)&pCont);
if (FAILED(hr)) exit(hr);
IADsDeleteOps *pOps;
hr = pCont->QueryInterface(IID_IADsDeleteOps,(void**)&pOps);
pCont->Release();
if(FAILED(hr) exit(hr);
pOps->DeleteObject(0);
pOps-Release();
解决方案
The account you are using to perform the action does not have permission to delete the target object.