Skip to content

Commit f8c46c9

Browse files
Merge pull request SharePoint#9521 from SharePoint/javieralvarezchiang-add-nobanner-to-preview
Update using-file-preview.md
2 parents 9b69f97 + 559a115 commit f8c46c9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

docs/embedded/tutorials/using-file-preview.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: File Previews
33
description: Preview SharePoint Embedded content
4-
ms.date: 11/28/2023
4+
ms.date: 02/14/2024
55
ms.localizationpriority: high
66
---
77

@@ -15,7 +15,6 @@ In order to preview a file in an `iframe`, you need to
1515

1616
1. Call Graph's driveItem preview endpoint and obtain the GetUrl
1717
1. Use the URL in an iFrame (or even open it in a new page)
18-
1. If you want to load the preview dynamically...
1918

2019
## Get the preview url using Graph
2120

@@ -48,9 +47,14 @@ The JSON response includes the preview URLs for each document. Use the one obtai
4847
}
4948
```
5049

50+
> [!TIP]
51+
> It is possible to remove the banner at the top by adding the parameter `nb=true` to the obtained URL. E.g.
52+
> `https://contoso.sharepoint.com/restOfUrl/embed.aspx?param1=value&nb=true`
53+
5154
> [!CAUTION]
5255
> Currently **getUrl** contains a parameter with an encrypted token that can only be used with your application. However, this may change in the near future and you may be asked to add an auth header as you do with other requests.
5356
57+
5458
## Use the URL in an `iframe`
5559

5660
The next step is simply to use the URL obtained in the previous step in a new page. You could have an endpoint in your application that serves a new page as similar to this one:
@@ -82,7 +86,7 @@ public async Task<ActionResult<string>> GetPreviewUrl(string driveId, string ite
8286
{
8387
// Obtain tokens for the the request
8488
// Use the function created in the first step
85-
return url;
89+
return url + "&nb=true"; //Use nb=true to suppress banner
8690
}
8791
```
8892

@@ -95,6 +99,6 @@ async function preview(driveId, itemId) {
9599
credentials: 'include',
96100
}).then(response => response.text());
97101

98-
document.getElementById('preview').src = response;
102+
document.getElementById('preview').src = response + "&nb=true"; //Use nb=true to suppress banner
99103
}
100104
```

0 commit comments

Comments
 (0)