IWSDiscoveryPublisher::UnPublish method (wsddisco.h)

Announces the departure of a network host by sending a Bye message.

Syntax

HRESULT UnPublish(
  [in]           LPCWSTR              pszId,
  [in]           ULONGLONG            ullInstanceId,
  [in]           ULONGLONG            ullMessageNumber,
  [in, optional] LPCWSTR              pszSessionId,
  [in, optional] const WSDXML_ELEMENT *pAny
);

Parameters

[in] pszId

The logical or physical address of the device, which is used as the device endpoint address. A logical address is of the form urn:uuid:{guid}. A physical address can be a URI prefixed by http or https, or simply a URI prefixed by uri. Whenever possible, use a logical address.

[in] ullInstanceId

Identifier for the current instance of the device being published. This identifier must be incremented whenever the service is restarted. For more information about instance identifiers, see Appendix I of the WS-Discovery specification.

Note  For compatibility with the WS-Discovery specification, this value must be less than or equal to UINT_MAX (4294967295).
 

[in] ullMessageNumber

Counter within the scope of the instance identifier for the current message. The message number must be incremented for each message.

Note  For compatibility with the WS-Discovery specification, this value must be less than or equal to UINT_MAX (4294967295).
 

[in, optional] pszSessionId

Unique identifier within the scope of the instance identifier for the current session. This parameter corresponds to the sequence identifier in the AppSequence block in the Probe message. For more information about sequence identifiers, see Appendix I of the WS-Discovery specification.

This parameter may be NULL.

[in, optional] pAny

Pointer to a WSDXML_ELEMENT structure that contains an XML element to be inserted in the "ANY" section of the message body.

Return value

Possible return values include, but are not limited to, the following:

Return code Description
S_OK
The method completed successfully.
E_INVALIDARG
One or more of the following conditions is true:
  • pszId is NULL.
  • The length of pszId exceeds WSD_MAX_TEXT_LENGTH (8192).
  • The length of pszSessionId exceeds WSD_MAX_TEXT_LENGTH (8192).
E_ABORT
The publisher has not been started. Attaching a notification sink starts the publisher. To attach a sink, call RegisterNotificationSink.
E_OUTOFMEMORY
Insufficient memory to complete the operation.

Remarks

If successful, UnPublish will send a WS-Discovery Bye message to the local subnet with the provided information.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header wsddisco.h (include Wsdapi.h)
DLL Wsdapi.dll

See also

IWSDiscoveryPublisher