microsoft / microsoft/CopilotStudioSamples
Copilot Studio adding `?web=1` to any sharepoint site url
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 797
- Forks
- 491
- PR merge metrics
- No merged PRs in 30d
Description
What sample tool are you using?
SharePoint PDF Page Citations - https://github.com/microsoft/CopilotStudioSamples/tree/main/authoring/snippets/topics/sharepoint-pdf-page-citations
Describe the bug
Seems to be some post processing that is adding ?web=1 into all sharepoint.com links. This stops the direct page link from applying. Here's an example: https://*.sharepoint.com/sites/.../file.pdf?web=1#page=5. Seems to apply to both SharePoint and Dataverse backed Sharepoint.
To Reproduce
Steps to reproduce the behavior:
- Follow instructions for sample
- Test with any PDF
Expected behavior
No ?web=1 in the URL. Especially for PDFs
Screenshots
See below.
Additional context
I've only confirmed with *.sharepoint.com URLs.
I've tested with hard coded URLs in the topic. When any of our domains are hard coded into the topic, the ?web=1 does not get added.
I've also tried just writing out a SharePoint folder URL to the response and it still happens. Example: https://*.sharepoint.com/sites/.../Shared%20Documents/?web=1
Shows ?web=1 being added in SharePoint (including into the middle of a file name in certain situations):
Shows not being added to non-SharePoint:
I added this to the topic to test:
- kind: SendActivity
id: sendActivity_plainUrlTest
displayName: Send plain text test URL
activity: |-
Test SharePoint URL in code block:
```
https://some.sharepoint.com/sites/Name/Shared%20Documents/document-260101.pdf
```
- kind: SendActivity
id: sendActivity_plainUrlTestNoCodeBlock
displayName: Send plain text test URL (no code block)
activity: ="Test SharePoint URL: https://some.sharepoint.com/sites/Name/Shared%20Documents/document-260101.pdf"
- kind: SendActivity
id: sendActivity_plainUrlTestBugNoCodeBlock
displayName: Send plain text test URL (no code block)
activity: ="Test SharePoint URL (potential bug): https://some.sharepoint.com/sites/Name/Shared%20Documents/document(2026.01.01).pdf"
- kind: SendActivity
id: sendActivity_plainUrlTestNonSharepoint
displayName: Send plain text test URL
activity: |-
Test Non-SharePoint URL in code block:
```
https://some.domain.com/sites/Name/Shared%20Documents/document-260101.pdf
```
- kind: SendActivity
id: sendActivity_plainUrlTestNonSharePointNoCodeBlock
displayName: Send plain text test URL (no code block)
activity: ="Test Non-SharePoint URL: https://some.domain.com/sites/Name/Shared%20Documents/document-260101.pdf"
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the SharePoint PDF Page Citations sample at authoring/snippets/topics/sharepoint-pdf-page-citations and reproduce the behavior using the listed YAML SendActivity examples. Compare SharePoint and non-SharePoint URLs, including PDF fragments and folder paths; done means identifying the responsible post-processing behavior and confirming that valid SharePoint links no longer receive ?web=1.
Written by the indexing model from the issue text.
Assessment
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100