Skip to content

Adds spe container recyclebinitem restore #6733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

milanholemans
Copy link
Contributor

@milanholemans milanholemans commented May 26, 2025

Closes #6085

@Jwaegebaert Jwaegebaert self-assigned this Jul 22, 2025
@Jwaegebaert Jwaegebaert requested a review from Copilot July 22, 2025 07:00
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new command spe container recyclebinitem restore to restore deleted SharePoint Embedded containers. The command allows restoration by container ID directly, or by container name when combined with container type information.

Key changes:

  • Implements restoration functionality for deleted containers via Microsoft Graph API
  • Supports multiple identification methods (ID, name with container type)
  • Includes comprehensive validation and error handling for multiple containers with same name

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
container-recyclebinitem-restore.ts Main command implementation with validation, Graph API integration, and container resolution logic
container-recyclebinitem-restore.spec.ts Comprehensive test suite covering validation, success scenarios, and error handling
commands.ts Adds the new command constant to the SPE commands registry
sidebars.ts Updates documentation navigation to include the new command
container-recyclebinitem-restore.mdx Complete documentation with usage examples and parameter descriptions


const containerTypeId = await this.getContainerTypeId(options, logger);

const containers = await odata.getAllItems<ContainerProperties>(`${this.resource}/v1.0/storage/fileStorage/deletedContainers?$filter=containerTypeId eq ${containerTypeId}&$select=id,displayName`);
Copy link
Preview

Copilot AI Jul 22, 2025

Choose a reason for hiding this comment

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

The containerTypeId parameter is directly interpolated into the OData filter query without proper escaping or validation, which could lead to OData injection vulnerabilities. Use proper parameter binding or escape the containerTypeId value before concatenation.

Suggested change
const containers = await odata.getAllItems<ContainerProperties>(`${this.resource}/v1.0/storage/fileStorage/deletedContainers?$filter=containerTypeId eq ${containerTypeId}&$select=id,displayName`);
const escapedContainerTypeId = encodeURIComponent(containerTypeId);
const containers = await odata.getAllItems<ContainerProperties>(`${this.resource}/v1.0/storage/fileStorage/deletedContainers?$filter=containerTypeId eq ${escapedContainerTypeId}&$select=id,displayName`);

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New command: m365 spe container recyclebinitem restore
2 participants