Class Link  |  Apps Script  |  Google for Developers (original) (raw)

Stay organized with collections Save and categorize content based on your preferences.

Detailed documentation

getLinkType()

Returns the [LinkType](/apps-script/reference/slides/link-type).

const shape = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0]; const link = shape.getLink(); if (link != null) { Logger.log(Shape has a link of type: ${link.getLinkType()}); }

Return

[LinkType](/apps-script/reference/slides/link-type)

Scripts that use this method require authorization with one or more of the following scopes:


getLinkedSlide()

Returns the linked [Slide](/apps-script/reference/slides/slide) for non-URL links types, if it exists. Returns null if the slide doesn't exist in the presentation, or if the [LinkType](/apps-script/reference/slides/link-type) is [LinkType.URL](/apps-script/reference/slides/link-type#URL).

const shape = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0]; const link = shape.getLink(); if (link != null && link.getLinkType() !== SlidesApp.LinkType.URL) { Logger.log(Shape has link to slide: ${link.getLinkedSlide()}); }

Return

[Slide](/apps-script/reference/slides/slide)

Authorization

Scripts that use this method require authorization with one or more of the following scopes:


getSlideId()

Returns the ID of the linked [Slide](/apps-script/reference/slides/slide) or null if the [LinkType](/apps-script/reference/slides/link-type) is not[LinkType.SLIDE_ID](/apps-script/reference/slides/link-type#SLIDE%5FID).

Note that the slide with the returned ID might not exist.

const shape = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0]; const link = shape.getLink(); if (link != null && link.getLinkType() === SlidesApp.LinkType.SLIDE_ID) { Logger.log(Shape has link to slide with ID: ${link.getSlideId()}); }

Return

String

Authorization

Scripts that use this method require authorization with one or more of the following scopes:


getSlideIndex()

Returns the zero-based index of the linked [Slide](/apps-script/reference/slides/slide) or null if the [LinkType](/apps-script/reference/slides/link-type) is not [LinkType.SLIDE_INDEX](/apps-script/reference/slides/link-type#SLIDE%5FINDEX).

Note that the slide at the returned index might not exist.

const shape = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0]; const link = shape.getLink(); if (link != null && link.getLinkType() === SlidesApp.LinkType.SLIDE_INDEX) { Logger.log(Shape has link to slide with index: ${link.getSlideIndex()}); }

Return

Integer

Authorization

Scripts that use this method require authorization with one or more of the following scopes:


getSlidePosition()

Returns the [SlidePosition](/apps-script/reference/slides/slide-position) of the linked [Slide](/apps-script/reference/slides/slide) or null if the [LinkType](/apps-script/reference/slides/link-type) is not [LinkType.SLIDE_POSITION](/apps-script/reference/slides/link-type#SLIDE%5FPOSITION).

Note that the slide with the returned relative position might not exist.

const shape = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0]; const link = shape.getLink(); if (link != null && link.getLinkType() === SlidesApp.LinkType.SLIDE_POSITION) { Logger.log( Shape has link to slide with relative position: ${ link.getSlidePosition()}, ); }

Return

[SlidePosition](/apps-script/reference/slides/slide-position)

Authorization

Scripts that use this method require authorization with one or more of the following scopes:


getUrl()

Returns the URL to the external web page or null if the [LinkType](/apps-script/reference/slides/link-type) is not [LinkType.URL](/apps-script/reference/slides/link-type#URL).

const shape = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0]; const link = shape.getLink(); if (link != null && link.getLinkType() === SlidesApp.LinkType.URL) { Logger.log(Shape has link to URL: ${link.getUrl()}); }

Return

String

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-12-02 UTC.