IOpcRelationship::GetSourceUri method (msopc.h)

Gets the URI of the relationship source.


HRESULT GetSourceUri(
  [out, retval] IOpcUri **sourceUri


[out, retval] sourceUri

A pointer to the IOpcUri interface of the OPC URI object that represents the URI of the relationship source.

Return value

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

Return code Description
The method succeeded.
The sourceUri parameter is NULL.


If the source of a relationship is the package itself, the URI in sourceUri represents the package root: "/".

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. Use the relative URI received in the targetUri parameter of the GetTargetUri method 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.


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


Open Packaging Conventions Fundamentals


Packaging API Reference

Packaging API Samples


Relationships Overview

Resolving a Part Name from a Target URI