IOpcRelationship::GetTargetUri method (msopc.h)

Gets the URI of the relationship target.

Syntax

HRESULT GetTargetUri(
  [out, retval] IUri **targetUri
);

Parameters

[out, retval] targetUri

A pointer to the IUri interface of the URI that represents the URI of the relationship's target.

If the relationship target is internal, the target is a part and the URI of the target is relative to the URI of the source part.

Return value

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

Return code Description
S_OK
The method succeeded.
E_POINTER
The targetUri parameter is NULL.

Remarks

The definitive way to find a part of interest is by using a relationship type.

Finding a part of interest requires several steps. For detailed information about finding a part, see the Parts Overview and Finding the Core Properties Part.

To determine whether the target of the relationship is internal or external, call the GetTargetUri method.

If the relationship target is internal, the target is a part.

If the relationship target is a part, the URI in targetUri is relative to the URI of the relationship source.

If the relationship  target is a part, form the part name by calling the IOpcUri::CombinePartUri method from the IOpcUri interface pointer received in sourceUri parameter of the GetSourceUri method. Use the relative URI received in targetUri as the input parameter of the IOpcUri::CombinePartUri call. For an example, see Resolving a Part Name from a Target URI.

For more information about relationships, see the Open Packaging Conventions Fundamentals and the ECMA-376 OpenXML, 1st Edition, Part 2: Open Packaging Conventions (OPC).

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

ECMA-376 OpenXML

External Resources

Getting Started with the Packaging API

IOpcRelationship

OPC_URI_TARGET_MODE

Open Packaging Conventions Fundamentals

Overviews

Packaging API Reference

Packaging API Samples

Reference

Relationships Overview

Resolving a Part Name from a Target URI