3.1.4.2.2 NetrDfsRemove2 (Opnum 20)

The NetrDfsRemove2 (Opnum 20) method removes the specified link or link target.

The NetrDfsRemove2 method uses the following MIDL syntax.

 NET_API_STATUS NetrDfsRemove2(
   [in, string] WCHAR* DfsEntryPath,
   [in, string] WCHAR* DcName,
   [in, unique, string] WCHAR* ServerName,
   [in, unique, string] WCHAR* ShareName,
   [in, out, unique] DFSM_ROOT_LIST** ppRootList
 );

DfsEntryPath: The pointer to a DFS link path that contains the name of the DFS link to remove.

DcName: The pointer to a null-terminated Unicode string. For a domain-based DFS namespace, this string contains the host name of the DC to be used by the DFS root target that is removing the DFS link. This parameter MAY be a NULL pointer; otherwise, it MUST be the PDC for the domain of the DFS namespace.<87>

ServerName: The pointer to a null-terminated Unicode DFS link target host name string. This MUST be a NULL pointer when the link and all of the link targets are to be removed.

ShareName: The pointer to a null-terminated Unicode DFS link target share name string. This MUST be a NULL pointer when the link and all of the link targets are to be removed.

ppRootList: On success, returns a list of DFS root targets in the domain-based DFS namespace that the client will be responsible for notifying of the change in the DFS namespace. See section 3.2.4.2.2. This list MAY be empty if the server has performed the notification.<88>

Return Values: The method MUST return 0 on success and a nonzero error code on failure. The method can return any specific error code value, as specified in [MS-ERREF] section 2.2. The most common error codes are listed in the following table.

Return value/code

Description

0x00000000

ERROR_SUCCESS

Successful completion.

0x00000002

ERROR_FILE_NOT_FOUND

The specified DFS link target was not found as a target of the specified DFS link.

0x00000005

ERROR_ACCESS_DENIED

Permission to perform the operation was denied.

0x00000057

ERROR_INVALID_PARAMETER

An incorrect parameter was specified.

0x00000490

ERROR_NOT_FOUND

The specified DFS namespace or DFS link does not exist.

The server MAY<89> implement this method.

If the NetrDfsRemove (Opnum 2) method on a server does not support a domain-based namespace, the server SHOULD support a domain-based namespace in the NetrDfsRemove2 (Opnum 20) method.<90><91>

The server MUST verify the existence of the DFS namespace that the DfsEntryPath parameter specifies. If the namespace does not exist, the server MUST return ERROR_NOT_FOUND.

The server MUST verify the existence of the DFS link DfsEntryPath parameter specifies. If that existence check fails, the server MUST return ERROR_NOT_FOUND.

The server MUST verify the existence of the DFS link target of the DFS link that the ServerName and RootShare parameters specify. If that existence check fails, the server MUST return ERROR_FILE_NOT_FOUND.

If the ServerName and ShareName parameters are both NULL, the server MUST remove the link and all its link targets. If the ServerName and ShareName are not NULL, the server MUST remove the specified link target. If the specific target is the last target of the link, the server MUST remove the link as well. If only one of ServerName or ShareName is NULL, the server MUST return ERROR_INVALID_PARAMETER.

The server MUST update the same fields in the DFS metadata for a domain-based DFS namespace, as specified in the NetrDfsRemove method.

The server MUST synchronously update the DFS metadata of a domain-based DFS namespace.

If DFS root scalability mode is not enabled for the domain-based DFS namespace, the server MUST do one of the following:

  • Notify other DFS root targets of the change in DFS metadata by asynchronously issuing a NetrDfsSetInfo method with the Level parameter 101, and with the State field of DFS_INFO_101 set to DFS_VOLUME_STATE_RESYNCHRONIZE. The returned ppRootList parameter MUST be empty.

  • Perform no notification of the other root targets, returning a list of DFS root targets to the client in the ppRootList  parameter.