class Program { static void Main(string[] args) { string fileName = @"..\..\Documents\Myppt7.pptx"; foreach (string s in GetAllExternalHyperlinksInPresentation(fileName)) Console.WriteLine(s); } // Returns all the external hyperlinks in the slides of a presentation. public static IEnumerable GetAllExternalHyperlinksInPresentation(string fileName) { // Declare a list of strings. List ret = new List(); // Open the presentation file as read-only. using (PresentationDocument document = PresentationDocument.Open(fileName, false)) { // Iterate through all the slide parts in the presentation part. foreach (SlidePart slidePart in document.PresentationPart.SlideParts) { IEnumerable links = slidePart.Slide.Descendants(); // Iterate through all the links in the slide part. foreach (Drawing.HyperlinkType link in links) { // Iterate through all the external relationships in the slide part. foreach (HyperlinkRelationship relation in slidePart.HyperlinkRelationships) { // If the relationship ID matches the link ID… if (relation.Id.Equals(link.Id)) { // Add the URI of the external relationship to the list of strings. ret.Add(relation.Uri.AbsoluteUri); } } } } } // Return the list of strings. return ret; } }