IOpcPartUri::GetSourceUri method (msopc.h)

Gets the source URI of the relationships that are stored in a Relationships part. The current part URI object represents the part name of that Relationships part.

Syntax

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

Parameters

[out, retval] sourceUri

A pointer to the IOpcUri interface of the OPC URI object that represents the URI of the source of the relationships stored in the Relationships part.

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 sourceUri parameter is NULL.
OPC_E_RELATIONSHIP_URI_REQUIRED
0x80510003
The part name of a Relationships part is required, but the part name is not that of a Relationships part.

For more information about the part names of Relationships parts, see the OPC.

CreateUri function error
An HRESULT error code from the CreateUri function.
WinINet error
An HRESULT error code from a WinINet API.

Remarks

If the current part URI object represents the part name of the Relationships part that stores package relationships ("/_rels/.rels"), the OPC URI object returned in sourceUri will represent the package root ("/").

If the current part URI object is not the part name of a Relationships part, this method fails with the OPC_E_RELATIONSHIP_URI_REQUIRED error. The syntax for Relationship part names is specified in the OPC.

The following table shows possible current part URIs and the source URI that would be returned by this method.

Current Part URI Current Part URI Description Source URI Source URI Description Return Value
/mydoc/_rels/picture.jpg.rels The part name of a Relationships part /mydoc/picture.jpg The part name of the part that is the source of the relationships stored in the Relationships part that is represented by the current part URI object S_OK
/_rels/.rels The part name of a Relationships part / The package root; the source of the relationships stored in the Relationships part that is represented by the current part URI object S_OK
/mydoc/image/chart1.jpg The part name of a part that is not a Relationships part Undefined Undefined OPC_E_RELATIONSHIP_URI_REQUIRED
/_rels/a.jpg The part name of a part that is not a Relationships part Undefined Undefined OPC_E_RELATIONSHIP_URI_REQUIRED
 

Support on Previous Windows Versions

The behavior and performance of this method is the same on all supported Windows versions. For more information, see Getting Started with the Packaging API, and Platform Update for Windows Vista.

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, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps only]
Target Platform Windows
Header msopc.h

See also

ECMA-376 OpenXML

External Resources

Getting Started with the Packaging API

IOpcPartUri

Open Packaging Conventions Fundamentals

Overviews

Packaging API Reference

Packaging API Samples

Packaging Errors

Parts Overview

Platform Update for Windows Vista

Reference