Export (0) Print
Expand All

PackageRelationship Class

Represents an association between a source Package or PackagePart, and a target object which can be a PackagePart or external resource.

System.Object
  System.IO.Packaging.PackageRelationship

Namespace:  System.IO.Packaging
Assembly:  WindowsBase (in WindowsBase.dll)

public class PackageRelationship

The PackageRelationship type exposes the following members.

  NameDescription
Public propertyIdGets a string that identifies the relationship.
Public propertyPackageGets the Package that contains this relationship.
Public propertyRelationshipTypeGets the qualified type name of the relationship.
Public propertySourceUriGets the URI of the package or part that owns the relationship.
Public propertyTargetModeGets a value that indicates whether the target of the relationship is Internal or External to the Package.
Public propertyTargetUriGets the URI of the target resource of the relationship.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

A PackageRelationship defines an association between a source Package or PackagePart to a target PackagePart or external resource. The source object is considered the "owner" of the relationship.

The PackageRelationship class has no public constructor; instead, two Create methods are used:

Package.CreateRelationship

Creates a "package-level" relationship—from a package to a specified part or external resource.

PackagePart.CreateRelationship

Creates a "part-level" relationship—from one part to another part or external resource.

The source package or part is identified by the SourceUri property of the relationship. The target part or external resource is identified by the TargetUri property of the relationship.

Creating or deleting a relationship does not affect the source or target objects in any way.

If a source object is deleted, all relationships owned by the object are also deleted.

Relationships enable navigation both in a document and between documents. Relationships also support document object model services, such as linking a PrintTicket to specific document elements when printing.

For more information about PackageRelationship elements see Section 1.3 "Relationships" in the Open Packaging Conventions specification available for download at http://go.microsoft.com/fwlink/?LinkID=71255.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft