IOpcPartUri::GetSourceUri method

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

sourceUri [out, retval]

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/valueDescription
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 DescriptionSource URISource URI DescriptionReturn Value
/mydoc/_rels/picture.jpg.relsThe part name of a Relationships part/mydoc/picture.jpgThe 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 objectS_OK
/_rels/.relsThe 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 objectS_OK
/mydoc/image/chart1.jpgThe part name of a part that is not a Relationships partUndefined UndefinedOPC_E_RELATIONSHIP_URI_REQUIRED
/_rels/a.jpgThe part name of a part that is not a Relationships partUndefined UndefinedOPC_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

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]

Header

Msopc.h

IDL

Opcparturi.idl

See also

IOpcPartUri
Overviews
Getting Started with the Packaging API
Open Packaging Conventions Fundamentals
Parts Overview
Platform Update for Windows Vista
Reference
Packaging Errors
Packaging API Reference
Packaging API Samples
External Resources
ECMA-376 OpenXML

 

 

Community Additions

ADD
Show:
© 2014 Microsoft