Sharepoint Embed Code, open to page

Van Hengel, Peter 0 Reputation points
2023-10-25T11:53:57.9766667+00:00

Hi, when using sharepoint online, you can easily generate an embed code, basically an iframe, that displays a document on a site other than sharepoint.

It looks like this:

<iframe src="https://xxxxxxx.sharepoint.com/sites/xxxxxxx/_layouts/15/embed.aspx?UniqueId=xxxx-xxxxx-xxxxxx-xxxxxx" width="640" height="360" frameborder="0" scrolling="no" allowfullscreen title="SampleDoc.pdf"></iframe>

Works great, my question is, once this page is rendered is there an API we can use from the parent window to scroll around the document (or maybe other functionality) and/or query string parameters to open to a specific page?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,043 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,767 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ChengFeng - MSFT 5,015 Reputation points Microsoft Vendor
    2023-10-26T05:13:49.0066667+00:00

    Hi @Van Hengel, Peter,

    Thank you for posting in this community.

    It appears that we can only connect:

    • OOB webparts between each other. See list here.
    • Two or more custom SPFx webpart.

    However, there is no way to subscribe a custom SPFx webpart to the OOTB webparts. At least it's not officially described anywhere. I have a suspicion that with some hacking it can still be done, but it's not documented yet.

    Quote from https://docs.microsoft.com:

    For the OOB list, we cannot write custom code with it. You could use the OOB List properties web part to connect it. Refer to this documenatation for more: https://support.microsoft.com/en-us/office/connect-web-parts-in-sharepoint-b457668c-d843-4b1b-8977-a6f9228a1dec?ns=spostandard&version=16&syslcid=1033&uilcid=1033&appver=spo160&helpid=spo_connectwebparts&ui=en-us&rs=en-us&ad=us#bkmk_listproperties

    this page is rendered is there an API we can use from the parent window to scroll around the document (or maybe other functionality) and/or query string parameters to open to a specific
    

    What you mentioned, as far as I know, you need a custom spfx component that contains an iframe and a search box

    The search box retrieves the data you need via the Graph API. Then pass the data to the Iframe's URL. This can form a dynamic association

    Here is a guide on how to set up spfx for your reference:

    https://learn.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part

    Hope these are helpful to you!


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards

    Cheng Feng