IOpcRelationship interface

Represents a relationship, which is a link between a source, which is a part or the package, and a target. The relationship's target can be a part or external resource.

When to implement

Never. Custom implementations of this interface are not supported.

Members

The IOpcRelationship interface inherits from the IUnknown interface. IOpcRelationship also has these types of members:

Methods

The IOpcRelationship interface has these methods.

MethodDescription
GetId

Gets the unique identifier of the relationship.

GetRelationshipType

Gets the relationship type.

GetSourceUri

Gets the URI of the relationship source.

GetTargetMode

Gets a value that describes whether the relationship's target is internal or external to the package.

GetTargetUri

Gets the URI of the relationship target.

 

Remarks

To create a relationship object to represent a relationship, call the IOpcRelationshipSet::CreateRelationship method. To get a pointer to the interface of a relationship object that represents an existing relationship, call the IOpcRelationshipSet::GetRelationship or IOpcRelationshipEnumerator::GetCurrent method.

Example relationship markup for a relationship that targets a part:


<Relationship Id="rId1"
    Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
    Target="word/document.xml" />

Using the relationship type (Type attribute of the Relationship element) is the definitive way find a part in a package. For more information about why the relationship type is used, see the Parts Overview. For an example of to use the relationship type to find a part, see Finding the Core Properties Part.

Valid identifiers for relationships conform to the restrictions for xsd:ID, which are documented in section 3.3.8 ID of the W3C Recommendation, XML Schema Part 2: Datatypes Second Edition (http://go.microsoft.com/fwlink/p/?linkid=126664).

IOpcRelationship interface methods provide access to relationship properties for a relationship (which is represented by a relationship object). The methods, associated properties and descriptions are listed in the following table.

MethodPropertyDescription
GetId Relationship identifier

The unique, arbitrary identifier of a relationship that is local to the package.

GetRelationshipType Relationship type

The qualified name of a relationship defined by the package designer.

GetSourceUri Source URI

The URI of the relationship's source. The source URI can be the URI of the package or of a part.

GetTargetMode Target mode

Indicates whether the relationship's target is internal or external to the package.

GetTargetUri Target URI

The URI of the relationship's target.

 

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

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

Msopc.h

IDL

Msopc.idl

See also

Core Packaging Interfaces
Overviews
Finding the Core Properties Part
Getting Started with the Packaging API
Open Packaging Conventions Fundamentals
Relationships Overview
Reference
IOpcRelationshipSet
OPC_URI_TARGET_MODE
Packaging API Reference
Packaging API Samples
External Resources
ECMA-376 OpenXML

 

 

Community Additions

ADD
Show: