Düzenle

Aracılığıyla paylaş


SWbemServices.AssociatorsOf method

The AssociatorsOf method of the SWbemServices object returns a collection of objects (classes or instances) called endpoints that are associated with a specified object. This method performs the same function that the ASSOCIATORS OF WQL query performs.

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

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

Syntax

objWbemObjectSet = .AssociatorsOf( _
  ByVal strObjectPath, _
  [ ByVal strAssocClass ], _
  [ ByVal strResultClass ], _
  [ ByVal strResultRole ], _
  [ ByVal strRole ], _
  [ ByVal bClassesOnly ], _
  [ ByVal bSchemaOnly ], _
  [ ByVal strRequiredAssocQualifier ], _
  [ ByVal strRequiredQualifier ], _
  [ ByVal iFlags ], _
  [ ByVal objwbemNamedValueSet ] _
)

Parameters

strObjectPath

Required. String that contains the object path of the source class or instance. For more information, see Describing the Location of a WMI Object.

strAssocClass [optional]

String that contains an association class. If specified, this parameter indicates that the returned endpoints must be associated with the source through the specified association class or a class that is derived from this association class.

strResultClass [optional]

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

strResultRole [optional]

String that contains a property name. If specified, this parameter indicates that the returned endpoints must play a particular role in their association with the source object. The role is defined by the name of a specified property (which must be a reference property) of an association.

strRole [optional]

String that contains a property name. If specified, this parameter indicates that the returned endpoints must participate in an association with the source object in which the source object plays a particular 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 a list of class names should be returned rather than actual instances of the classes. These are the classes to which the endpoint instances belong. The default value for this parameter is FALSE.

bSchemaOnly [optional]

Boolean value that indicates whether 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 represent classes that are suitably associated with the source class in schema.

strRequiredAssocQualifier [optional]

String that contains a qualifier name. If specified, this parameter indicates that the returned endpoints must be associated with the source object through an association class that includes the specified qualifier.

strRequiredQualifier [optional]

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

iFlags [optional]

Integer that specifies additional flags to the operation. The default value for this parameter is wbemFlagReturnImmediately, which calls the method in the semisynchronous mode. 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 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 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 call is successful, an SWbemObjectSet object is returned.

Error codes

After the completion of the AssociatorsOf 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.

wbemErrNotFound - 2147749890 (0x80041002)

Requested item was not found.

Remarks

The method retrieves the instances of managed resources that are associated with a specified resource through one or more association classes. You provide the object path for the originating endpoint, and AssociatorsOf returns the managed resources at the opposite endpoint. The AssociatorsOf method performs the same function that the ASSOCIATORS OF WQL query performs.

For more information about the ASSOCIATORS OF WQL query, source instances, and endpoints, 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.AssociatorsAsync_

SWbemServices.AssociatorsOfAsync

SWbemObject.References_

SWbemServices.ReferencesTo