IOpcRelationship interface (msopc.h)
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.
The IOpcRelationship interface inherits from the IUnknown interface. IOpcRelationship also has these types of members:
The IOpcRelationship interface has these methods.
Gets the unique identifier of the relationship.
Gets the relationship type.
Gets the URI of the relationship�source.
Gets a value that describes whether the relationship's target is internal or external to the package.
Gets the URI of the relationship�target.
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://www.w3.org/TR/xmlschema-2/#ID).
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.
|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).
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]|