Düzenle

Aracılığıyla paylaş


SWbemServices.ReferencesTo method

The ReferencesTo method of the SWbemServices object returns a collection of all association classes or instances that refer to a specific source class or instance. This method performs the same function that the REFERENCES OF WQL query performs.

This method is called in the semisynchronous mode. For more information, see Calling a Method.

For an explanation of this syntax, see Document Conventions for the Scripting API.

Syntax

objWbemObjectSet = .ReferencesTo( _
  ByVal strObjectPath, _
  [ ByVal strResultClass ], _
  [ ByVal strRole ], _
  [ ByVal bClassesOnly ], _
  [ ByVal bSchemaOnly ], _
  [ ByVal strRequiredQualifier ], _
  [ ByVal iFlags ], _
  [ ByVal objWbemNamedValueSet ] _
)

Parameters

strObjectPath

Required. String that contains the object path of the source for this method. For more information, see Describing the Location of a WMI Object.

strResultClass [optional]

String that contains a class name. If specified, this parameter indicates that the returned association objects must belong to or be derived from the class that is specified in this parameter.

strRole [optional]

String that contains a property name. If specified, this parameter indicates that the returned association objects must be limited to those in which the source object plays a specific role. The role is defined by the name of a specified property (which must be a reference property) of an association.

bClassesOnly [optional]

Boolean value that indicates whether or not a list of class names should be returned rather than actual instances of the classes. These are the classes to which the association objects belong. The default value for this parameter is FALSE.

bSchemaOnly [optional]

Boolean value that indicates whether or not the query applies to the schema rather than the data. The default value for this parameter is FALSE. It can only be set to TRUE if the strObjectPath parameter specifies the object path of a class. When set to TRUE, the set of returned endpoints represents classes that are suitably associated with the source class in the schema.

strRequiredQualifier [optional]

String that contains a qualifier name. If specified, this parameter indicates that the returned association objects must include the specified qualifier.

iFlags [optional]

Integer that specifies additional flags to the operation. The default for this parameter is wbemFlagReturnImmediately, which directs the call to return immediately rather than wait until the query has completed. This parameter can accept the following values.

wbemFlagForwardOnly (32 (0x20))

Causes a forward-only enumerator to be returned. Forward-only enumerators are generally much faster and use less memory than conventional enumerators, but they do not allow calls to SWbemObject.Clone_.

wbemFlagBidirectional (0 (0x0))

Causes Windows Management Instrumentation (WMI) to retain pointers to objects of the enumeration until the client releases the enumerator.

wbemFlagReturnImmediately (16 (0x10))

Causes the call to return immediately.

wbemFlagReturnWhenComplete (0 (0x0))

Causes this call to block until the query has completed. This flag calls the method in the synchronous mode.

wbemFlagUseAmendedQualifiers (131072 (0x20000))

Causes WMI to return class amendment data along with the base class definition. For more information, see Localizing WMI Class Information.

objWbemNamedValueSet [optional]

Typically, this is undefined. Otherwise, this is an SWbemNamedValueSet object whose elements represent the context information that can be used by the provider that is servicing the request. A provider that supports or requires such information must document the recognized value names, data type of the value, allowed values, and semantics.

Return value

If the method is successful, the method returns an SWbemObjectSet object.

Error codes

After the completion of the ReferencesTo method, the Err object may contain one of the error codes in the following list.

Note

A returned collection with zero elements is not an error.

wbemErrAccessDenied - 2147749891 (0x80041003)

Current user does not have the permission to view one or more of the classes returned by the call.

wbemErrFailed - 2147749889 (0x80041001)

Unspecified error.

wbemErrInvalidParameter - 2147749896 (0x80041008)

Invalid parameter was specified.

wbemErrOutOfMemory - 2147749894 (0x80041006)

Not enough memory to complete the operation.

wbemFlagUseAmendedQualifiers - 131072 (0x20000)

Causes WMI to return class amendment data with the base class definition.

Remarks

For more information about the REFERENCES OF associated WQL query, source instances, and association objects, see ASSOCIATORS OF Statement.

Requirements

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Header
Wbemdisp.h
Type library
Wbemdisp.tlb
DLL
Wbemdisp.dll
CLSID
CLSID_SWbemServices
IID
IID_ISWbemServices

See also

SWbemServices

SWbemObject.Associators_

SWbemObject.References_

SWbemServices.AssociatorsOf