共用方式為


3.1.4.6.2 get_Item (Opnum 8)

The get_Item method gets the item in the collection with a specified ID.

 [id(DISPID_VALUE), propget] HRESULT Item(
   [in] BSTR objectID,
   [out, retval] VARIANT* pItem
 );

objectID: The name of the object to get from the collection. If the underlying collection is of the publisher or subscriber application-specific subscription properties, this name MUST conform to the specification of application-specific property names, as specified in section 2.2.2.1. If the underlying collection is event classes, this MUST conform to the specification of EventClassCollectionIdentifier, as specified in section 2.2.6. If the underlying collection is subscriptions, this MUST conform to the specification of SubscriptionCollectionIdentifier, as specified in section 2.2.7.

pItem: If the function returns a successful HRESULT, this MUST contain an application-specific publisher/subscriber property, as specified in section 2.2.2.2, if the underlying collection is of publisher/subscriber application-specific subscriptions properties. If the underlying collection is event classes, this MUST contain a VT_UNKNOWN for the DCOM object that supports the IEventClass2 DCOM interface. If the underlying collection is subscriptions, this MUST contain a VT_UNKNOWN for the DCOM object that supports the IEventSubscription DCOM interface.

Return Values: An HRESULT that specifies success or failure. All success codes MUST be treated the same, and all failure codes MUST be treated the same.

When this method is invoked, the server MUST validate the objectID parameter for syntax. If the validation fails, the server MUST fail the call and return a failure HRESULT back to the client. Otherwise, the server MUST enumerate the collection and match the objectID to the individual objects in the collection. If an object is found that has a matching objectID, it MUST be returned through the pItem parameter. Otherwise, the server MUST fail the call.