sharepointembed

How to modify SharePoint embed results using the /_layouts/15/embed.aspx endpoint?


Lets say I have a document:

https://{tenant}.sharepoint.com/sites/{site-collection}/Shared%20Documents/Document.docx

Then I can use the "endpoint" _layouts/15/embed.aspx?Id= for an url that I can use to embed that document:

https://{tenant}.sharepoint.com/sites/{site-collection}/_layouts/15/embed.aspx?Id=/sites/{site-collection}/Shared%20Documents/Document.docx

How can I modify that url to hide the border and the page control?

Where can I find a documentation on the supported query arguments?

Is it possible to use this api endpoint to modify the resulting view? For example hide the border and the page navigation?

I asked some AI chat about the query options and it suggested some options. However, none of them seems to work except the Id.

Related:

https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-to-know-the-sharepoint-rest-service?tabs=csom

https://support.microsoft.com/en-us/office/add-content-to-a-sharepoint-space-with-the-embed-web-part-7ffe2898-edcf-4556-88b8-16567fc2ab7a

https://sharepointstuff.com/2021/03/30/useful-sharepoint-urls/comment-page-1/


Solution

  • I did not find extra query options and the result of embed endpoint contains a nested iframe structure where content is loaded in several steps.

    Thefore, I applied following css workaround to hide the pagination control and "zoom in" to hide the borders for embedded Word documents:

    div .ItemPreview-detailsBar {
      display: none;
      background-color: red;
    }
    
    #WebApplicationFrame {  
      margin-left:-15px;
      margin-top:-15px;  
      width: 108%; 
      height: 108%;   
      background-color: white !important; 
    }