Skip to content

Update Get-SPOMalwareFileContent.md#1175

Merged
Ruchika-mittal01 merged 4 commits into
MicrosoftDocs:mainfrom
NirupamaMeesala:docs-editor/Get-SPOMalwareFileContent-1780674330
Jun 5, 2026
Merged

Update Get-SPOMalwareFileContent.md#1175
Ruchika-mittal01 merged 4 commits into
MicrosoftDocs:mainfrom
NirupamaMeesala:docs-editor/Get-SPOMalwareFileContent-1780674330

Conversation

@NirupamaMeesala
Copy link
Copy Markdown
Contributor

Submitted via Learn Editor.

@NirupamaMeesala NirupamaMeesala marked this pull request as ready for review June 5, 2026 15:45
@NirupamaMeesala
Copy link
Copy Markdown
Contributor Author

Example 3 here has a line saying $localFolder = ".$fileName". I believe this has worked in the past, but is no longer working per reports from Support. Additionally, no error is returned if you run the whole script together. Specifying a full path works, e.g. “C:\temp$filename”. I believe others could encounter this issue too. Could the article be updated, please, at least to specify a full path?

FYI, here is what Copilot confirmed about the cause:
Why the relative path can fail
New-Object IO.FileStream resolves relative paths against the current process working directory, which is not always what you think it is.
In PowerShell, these can differ:
Get-Location
[Environment]::CurrentDirectory
Some cmdlets — especially older CSOM/SPO cmdlets — can change internal execution context or run in ways where the underlying .NET stream APIs no longer resolve .\ predictably.
So what happens is often:

  1. FileStream creation appears to succeed
  2. The target stream becomes invalid/disposed/fails silently during write
  3. The SPO response stream continues reading
  4. The loop attempts a write to a bad/closed stream
  5. You get the misleading: ‘Cannot access a closed file.’ even though the actual problem is the file destination path.

@learn-build-service-prod
Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 5, 2026

@sachin-lalwani
You've been added as a reviewer to this pull request because you're listed as a Content Lead for the product area or feature covered by one or more articles in this PR.

Before this PR can be merged, a Content Lead needs to add the Sign off label to it. Only one of the listed reviewers needs to add the Sign off label. Before you sign off a PR, confirm the following:

  • The PR is not in draft state. When the changes in this PR are ready to be published, select the Ready to merge button at the bottom of the page.
  • Article content has been checked for technical accuracy.
  • There are no errors or warnings in build validation.
  • There are no severity 1 or 2 PoliCheck issues.
  • All required PR checks at the bottom of the PR are passing.

After you've confirmed the above, do the following to sign off:

  1. Select the gear next to Labels.
  2. Select Sign off from the label list.
  3. Click away from the label list.

image

After you've signed off, our operations (PubOps) team will review the PR for issues that may impact formatting and the customer experience. If any changes are needed, they will return
the PR to the submitter with required changes. After they've completed those changes, you need to sign off again.

When the PR passes PubOps review, they'll merge the PR. If the PR is merged into the main branch, changes will go live within the next couple hours.

If you think you were incorrectly added as a reviewer, have questions about this process, or need help signing off on this PR, post a message to https://aka.ms/tcphelp.

@learn-build-service-prod
Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 8dfa7b9:

✅ Validation status: passed

File Status Preview URL Details
sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOMalwareFileContent.md ✅Succeeded View (sharepoint-ps)

For more details, please refer to the build report.

@learn-build-service-prod
Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod
Copy link
Copy Markdown
Contributor

Learn Build status updates of commit de3592f:

✅ Validation status: passed

File Status Preview URL Details
sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOMalwareFileContent.md ✅Succeeded View (sharepoint-ps)

For more details, please refer to the build report.

@@ -53,7 +53,7 @@ Example 2 returns the file stream.
$SPOFileUri = "https://contoso.com/sites/Marketing/Shared Documents/Doc1.docx"
Copy link
Copy Markdown
Contributor

@samkabue samkabue Jun 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$SPOFileUri

while here, also update the variable so it's correctly camelCase:

$spoFileUri

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@samkabue
Copy link
Copy Markdown
Contributor

samkabue commented Jun 5, 2026

$file = Get-SPOMalwareFile -FileUri $SPOFileUri

$spoFileUri


Refers to: sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOMalwareFileContent.md:60 in de3592f. [](commit_id = de3592f, deletion_comment = False)

@NirupamaMeesala
Copy link
Copy Markdown
Contributor Author

$file = Get-SPOMalwareFile -FileUri $SPOFileUri

$spoFileUri

Refers to: sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOMalwareFileContent.md:60 in de3592f. [](commit_id = de3592f, deletion_comment = False)

@NirupamaMeesala
Copy link
Copy Markdown
Contributor Author

Made the request case changes

@learn-build-service-prod
Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod
Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 7c1345f:

✅ Validation status: passed

File Status Preview URL Details
sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOMalwareFileContent.md ✅Succeeded View (sharepoint-ps)

For more details, please refer to the build report.

@learn-build-service-prod
Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod
Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 7c1345f:

✅ Validation status: passed

File Status Preview URL Details
sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOMalwareFileContent.md ✅Succeeded View (sharepoint-ps)

For more details, please refer to the build report.

@samkabue samkabue added the Sign off The pull request is ready to be reviewed and merged by PubOps label Jun 5, 2026
@Ruchika-mittal01 Ruchika-mittal01 self-assigned this Jun 5, 2026
@Ruchika-mittal01 Ruchika-mittal01 added the In review PubOps is reviewing the pull request label Jun 5, 2026
@Ruchika-mittal01 Ruchika-mittal01 added the PubOps fixes PubOps has fixed some issues in this PR. label Jun 5, 2026
@learn-build-service-prod
Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod
Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 5bb9d25:

❌ Validation status: errors

Please follow instructions here which may help to resolve issue.

Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them.

@learn-build-service-prod
Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod
Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 5bb9d25:

✅ Validation status: passed

File Status Preview URL Details
sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOMalwareFileContent.md ✅Succeeded View (sharepoint-ps)

For more details, please refer to the build report.

@learn-build-service-prod
Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod
Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 5bb9d25:

✅ Validation status: passed

File Status Preview URL Details
sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Get-SPOMalwareFileContent.md ✅Succeeded View (sharepoint-ps)

For more details, please refer to the build report.

@Ruchika-mittal01 Ruchika-mittal01 merged commit ec079d7 into MicrosoftDocs:main Jun 5, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

In review PubOps is reviewing the pull request Microsoft submitter PubOps fixes PubOps has fixed some issues in this PR. sharepoint-server-itpro/svc Sign off The pull request is ready to be reviewed and merged by PubOps

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants