PackUriHelper.GetSourcePartUriFromRelationshipPartUri Method (Uri)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Returns the SourceUri from the PackageRelationship with a specified URI.

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

public static Uri GetSourcePartUriFromRelationshipPartUri(
	Uri relationshipPartUri


Type: System.Uri

The URI of the relationship part to return the SourceUri from.

Return Value

Type: System.Uri

The SourceUri of the PackagePart from the relationship with the specified relationshipPartUri.

Exception Condition

relationshipPartUri is null.


relationshipPartUri is an absolute URI.


relationshipPartUri syntax is not valid for a PackagePart.


relationshipPartUri does not reference a relationship part.


The SourceUri of the relationship part references another relationship part (not valid, see Remarks).

The SourceUri property of a relationship part must identify either the Package ("/") or a PackagePart that is not a PackageRelationship.

For example, if the package part "/files/document.xaml" is the source owner of the relationship part "/files/_rels/document.xaml.rels", calling GetSourcePartUriFromRelationshipPartUri with the relationshipPartUri parameter of "/files/_rels/document.xaml.rels" returns the SourceUri of "/files/document.xaml".

.NET Framework
Available since 3.0
Return to top