IADsContainer::MoveHere method (iads.h)

   日期:2024-12-26    作者:yci8m 移动:http://ljhr2012.riyuangf.com/mobile/quote/43502.html

The IADsContainer::MoveHere method moves a specified object to the container that implements this interface.The method can be used to rename an object.

IADsContainer::MoveHere method (iads.h)



The null-terminated Unicode string that specifies the ADsPath of the object to be moved.

The null-terminated Unicode string that specifies the relative name of the new object within the container. This can be NULL, in which case the object is moved. If it is not NULL, the object is renamed accordingly in the process.

Pointer to a pointer to the IDispatch interface on the moved object.

This method supports standard return values, including S_OK, for a successful operation. For more information about error codes, see ADSI Error Codes.

In Active Directory, you can move an object within the same domain or from different domains in the same directory forest. For the cross domain move, the following restrictions apply:

  • The destination domain must be in the native mode.
  • Objects to be moved must be a leaf object or an empty container.
  • NT LAN Manager (NTLM) cannot perform authentication; use Kerberos authentication or delegation. Be aware that if Kerberos authentication is not used, the password transmits in plaintext over the network. To avoid this, use delegation with secure authentication.
  • You cannot move security principals (for example, user, group, computer, and so on) belonging to a global group. When a security principal is moved, a new SID is created for the object at the destination. However, its old SID from the source, stored in the sIDHistory attribute, is preserved, as well as the password of the object.
 
 
The following code example moves the user, "jeffsmith" from the "South.Fabrikam.Com" domain to the "North.Fabrikam.Com" domain. First, it gets an IADsContainer pointer to the destination container, then the MoveHere call specifies the path of the object to move.

A serverless ADsPath can be used for either the source or the destination or both.

The IADsContainer::MoveHere method can be used either to rename an object within the same container or to move an object among different containers. Moving an object retains the object RDN, whereas renaming an object alters the RDN.

For example, the following code example performs the rename action.


The following code example performs the move.


In Visual Basic applications, you can pass vbNullString as the second parameter when moving an object from one container to another.


However, you cannot do the same with VBScript. This is because VBScript maps vbNullString to an empty string instead of to a null string, as does Visual Basic. You must use the RDN explicitly, as shown in the previous example.

 

Examples

The following code example shows how to use this method to rename an object.


The following code example moves a user object using the IADsContainer::MoveHere method.



Requirement Value Minimum supported client Windows Vista Minimum supported server Windows Server 2008 Target Platform Windows Header iads.h DLL Activeds.dll

ADSI Error Codes

ADS_AUTHENTICATION_ENUM

ADsOpenObject

IADsContainer

IADsContainer::CopyHere

IADsOpenDSObject::OpenDsObject


特别提示:本信息由相关用户自行提供,真实性未证实,仅供参考。请谨慎采用,风险自负。


举报收藏 0评论 0
0相关评论
相关最新动态
推荐最新动态
点击排行
{
网站首页  |  关于我们  |  联系方式  |  使用协议  |  隐私政策  |  版权隐私  |  网站地图  |  排名推广  |  广告服务  |  积分换礼  |  网站留言  |  RSS订阅  |  违规举报  |  鄂ICP备2020018471号