IOpcPartSet::GetPart method (msopc.h)

Gets a part object, which represents a specified part, in the set.

Syntax

HRESULT GetPart(
  [in]          IOpcPartUri *name,
  [out, retval] IOpcPart    **part
);

Parameters

[in] name

A pointer to the IOpcPartUri interface of the part URI object that represents the part name of a part.

[out, retval] part

A pointer to the IOpcPart of the part object that represents the part that has the specified part name.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code/value Description
S_OK
The method succeeded.
E_POINTER
The name parameter is NULL.
OPC_E_NO_SUCH_PART
0x80510018
The specified part does not exist.
Package Consumption error
An HRESULT error code from the Package Consumption Error Group.
Part URI error
An HRESULT error code from the Part URI Error Group.

Remarks

To retrieve the IOpcPart interface pointer of the part object that represents a specific part, call the PartExists method and pass in the part name to confirm that the part is represented in the set. If it is, call the GetPart method and pass in the part name to retrieve the IOpcPart interface pointer.

If the part URI object represents the part name of a Relationships part, this method will fail because Relationships parts are not included in the set.

The IOpcPart interface provides access to the properties of a part. For details about these properties, see the Parts Overview and IOpcPart.

Thread Safety

Packaging objects are not thread-safe.

For more information, see the Getting Started with the Packaging API.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header msopc.h

See also

Getting Started with the Packaging API

IOpcPartSet

Overviews

Packaging API Reference

Packaging API Samples

Packaging Errors

Parts Overview

Reference