PackagePart.GetRelationships Method

Returns a collection of all the relationships that are owned by this part.

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

public PackageRelationshipCollection GetRelationships ()
public PackageRelationshipCollection GetRelationships ()
public function GetRelationships () : PackageRelationshipCollection
You cannot use methods in XAML.

Return Value

A collection of all the relationships that are owned by the part.

Exception typeCondition


The part has been deleted.


The Package is not open (Dispose or Close has been called).


The package is write-only (relationship information cannot be read).

The returned collection is never a null reference (Nothing in Visual Basic); however, the collection might contain zero elements if the part does not define any relationships.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0