-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Improvement(sharepoint): added ability to create list items, different from create list #1379
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
Conversation
(cherry picked from commit df6ea35)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR adds a new SharePoint tool for creating list items, expanding the existing SharePoint integration to support adding individual items to SharePoint lists through Microsoft Graph API. The implementation introduces sharepointAddListItemTool which is distinct from the existing createListTool - while the latter creates entire SharePoint lists, this new tool adds data items to existing lists.
The change follows established patterns throughout the codebase:
- Tool Implementation: The new
add_list_items.tstool uses OAuth authentication, includes comprehensive parameter validation, and implements read-only field filtering to prevent system fields from being included in creation requests - Type Safety: A new
SharepointAddListItemResponseinterface is added to maintain TypeScript safety, following the same pattern as other SharePoint response types - Registry Integration: The tool is properly registered in the tools registry as
sharepoint_add_list_items, maintaining consistency with the naming convention - Block UI Integration: The SharePoint block is updated to include an 'Add List Items' operation in the dropdown, reusing existing field handling logic while properly distinguishing between creating new items (no itemId required) and updating existing ones
The tool supports flexible input formats (both {fields: {...}} and direct {fieldName: value} structures), includes robust error handling, and provides comprehensive logging for debugging. This completes the CRUD operations for SharePoint list management within the platform's workflow system.
Confidence score: 4/5
- This PR appears safe to merge with comprehensive implementation following established patterns
- Score reflects well-structured code with proper error handling and type safety, though complex field validation logic needs attention
- Pay close attention to the field handling logic in
add_list_items.tslines 72-122 for potential edge cases
5 files reviewed, 2 comments
| params.listItemFields !== null && | ||
| 'fields' in (params.listItemFields as Record<string, unknown>) && | ||
| Object.keys(params.listItemFields as Record<string, unknown>).length === 1 | ||
| ? ((params.listItemFields as any).fields as Record<string, unknown>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Type assertion to any should be avoided. Consider defining a proper type for the fields structure.
Context Used: Context - Avoid using type assertions to 'any' in TypeScript. Instead, ensure proper type definitions are used to maintain type safety. (link)
| }, | ||
|
|
||
| transformResponse: async (response: Response, params) => { | ||
| let data: any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Type assertion to any should be avoided. Define a proper interface for the Graph API response.
Context Used: Context - Avoid using type assertions to 'any' in TypeScript. Instead, ensure proper type definitions are used to maintain type safety. (link)
| throw new Error('No fields provided to create the SharePoint list item') | ||
| } | ||
|
|
||
| const readOnlyFields = new Set<string>([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did you get these?
…t from create list (simstudioai#1379) * added add list items (cherry picked from commit df6ea35) * bun run lint * minor changes --------- Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net> Co-authored-by: Adam Gough <adamgough@Adams-MacBook-Pro.local>
Summary
Added create list items.
Type of Change
Testing
See video
Checklist
Screenshots/Videos
Screen.Recording.2025-09-18.at.1.39.12.PM.mov