From codeapps-toolkit
Adds Dataverse tables or Power Platform connectors as data sources to a Code App, generating service wrappers and React Query hooks.
How this skill is triggered — by the user, by Claude, or both
Slash command
/codeapps-toolkit:add-datasourceThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Add Dataverse tables or Power Platform connectors as data sources to your Code App with automatic service layer and hook generation.
Add Dataverse tables or Power Platform connectors as data sources to your Code App with automatic service layer and hook generation.
This skill uses official patterns from Microsoft Learn (February 2026). See the codeapps-dataverse and codeapps-connector agents for detailed patterns.
pac code add-data-source command (PAC CLI 1.46+ for Dataverse, 1.50+ for SharePoint)src/generated//add-datasource dataverse account
/add-datasource dataverse contact
/add-datasource dataverse todos
/add-datasource connector shared_office365users [connection-id]
/add-datasource connector shared_sql [connection-id] [table-name] [dataset]
/add-datasource connector shared_sharepointonline [connection-id] [list-name] [site-url]
Add the account Dataverse table as a data source
Connect to Office 365 Users
Add SQL Server connection for the Users table
Parse arguments to determine:
pac code add-data-source -a dataverse -t $ARGUMENTS[1]
Examples:
pac code add-data-source -a dataverse -t account
pac code add-data-source -a dataverse -t todos
# Check generated model
ls src/generated/models/*$ARGUMENTS[1]*Model.ts
# Check generated service
ls src/generated/services/*$ARGUMENTS[1]*Service.ts
Create service layer wrapper:
Use the gen-service skill to create a Dataverse service wrapper for $ARGUMENTS[1]
The gen-service skill will create a proper service that:
as any type assertionCreate React Query hooks:
Use the gen-hook skill to create React Query hooks for $ARGUMENTS[1]
The gen-hook skill will create:
use<TableName> - Query hook for fetching recordsuseCreate<TableName> - Mutation hook for creating recordsuseUpdate<TableName> - Mutation hook for updating recordsuseDelete<TableName> - Mutation hook for deleting recordsHelp user discover connections:
pac connection list
Display available connections and ask user to select one (if not provided).
Nontabular Connectors (Office 365 Users, Weather, Translator):
Tabular Connectors (SQL Server, SharePoint, Azure Data Explorer):
For Nontabular Connectors:
pac code add-data-source -a $ARGUMENTS[1] -c $ARGUMENTS[2]
Example:
pac code add-data-source -a shared_office365users -c <connection-id>
For Tabular Connectors:
First, list available datasets and tables:
# List datasets
pac code list-datasets -a $ARGUMENTS[1] -c $ARGUMENTS[2]
# List tables in dataset
pac code list-tables -a $ARGUMENTS[1] -c $ARGUMENTS[2] -d $ARGUMENTS[4]
Then add the data source:
pac code add-data-source -a $ARGUMENTS[1] -c $ARGUMENTS[2] -t $ARGUMENTS[3] -d $ARGUMENTS[4]
Example (SQL Server):
pac code add-data-source -a shared_sql -c <connection-id> -t dbo.Users -d myDatabase
Example (SharePoint):
pac code add-data-source -a shared_sharepointonline -c <connection-id> -t Tasks -d <site-url>
For SQL Stored Procedures:
pac code add-data-source -a shared_sql -c $ARGUMENTS[2] -d $ARGUMENTS[3] -sp $ARGUMENTS[4]
ls src/generated/models/
ls src/generated/services/
Use the gen-service skill to create a connector service wrapper for $ARGUMENTS[1]
Use the gen-hook skill to create React Query hooks for $ARGUMENTS[1]
For better ALM, suggest using connection references instead of direct connections:
# List connection references in solution
pac code list-connection-references -s <solution-id>
# Add with connection reference
pac code add-data-source -a $ARGUMENTS[1] -cr <connection-reference-logical-name> -s <solution-id>
Benefits:
Provide code examples showing how to use the generated service and hooks:
Dataverse Example:
// In a component
import { useAccounts, useCreateAccount } from '@/features/accounts/hooks/useAccounts';
function AccountsPage() {
const { data: accounts, isLoading } = useAccounts();
const createAccount = useCreateAccount();
const handleCreate = async (name: string) => {
await createAccount.mutateAsync({ name });
};
if (isLoading) return <Spinner />;
return (
<div>
{accounts?.map(account => (
<div key={account.id}>{account.name}</div>
))}
</div>
);
}
Connector Example (Office 365 Users):
import { useUserProfile } from '@/features/profile/hooks/useUserProfile';
function ProfilePage() {
const { data: profile, isLoading } = useUserProfile();
if (isLoading) return <Spinner />;
return (
<div>
<h1>{profile?.displayName}</h1>
<p>{profile?.jobTitle}</p>
<p>{profile?.email}</p>
</div>
);
}
✅ Data source added successfully!
📊 Data Source: $ARGUMENTS[1]
📁 Generated Files:
- src/generated/models/<Name>Model.ts
- src/generated/services/<Name>Service.ts
- src/features/<name>/services/<Name>Service.ts
- src/features/<name>/hooks/use<Name>.ts
🔍 Next Steps:
1. Review generated service wrapper
2. Test data operations: npm run dev
3. Add UI components to display/modify data
4. Deploy when ready: /deploy-codeapp
💡 Pro Tip: Never modify files in src/generated/ - they're auto-generated!
| Connector | API ID | Type | Use Case |
|---|---|---|---|
| Dataverse | dataverse | Tabular | Tables, CRUD operations |
| SQL Server | shared_sql | Tabular | Database tables, stored procedures |
| SharePoint | shared_sharepointonline | Tabular | Lists, libraries |
| Office 365 Users | shared_office365users | Nontabular | User profiles, photos |
| Office 365 Groups | shared_office365groups | Nontabular | Group management |
| OneDrive for Business | shared_onedriveforbusiness | Nontabular | File operations |
| Microsoft Teams | shared_teams | Nontabular | Teams integration |
| MSN Weather | shared_msnweather | Nontabular | Weather data |
| Translator | shared_microsofttranslator | Nontabular | Translation |
Symptom: pac code add-data-source fails with connection not found
Fix:
pac connection listSymptom: Can't find specified table or dataset
Fix:
# List available datasets
pac code list-datasets -a <api-id> -c <connection-id>
# List tables in dataset
pac code list-tables -a <api-id> -c <connection-id> -d <dataset>
Symptom: TypeScript compilation errors after adding data source
Fix:
power.config.json.backup for configurationsrc/generated/ folderpac code delete-data-source -a <api-id> -ds <data-source-name>
pac code add-data-source ...
npm run buildSymptom: Can't access connector or table
Fix:
pac auth clear
pac auth create
If you need to remove a data source:
# Remove data source
pac code delete-data-source -a <api-id> -ds <data-source-name>
# Remove stored procedure
pac code delete-data-source -a <api-id> -ds <data-source-name> -sp <stored-procedure-name>
Note: This removes generated files. You'll need to manually delete custom service layers and hooks.
After adding data source, verify:
npm run buildnpm run lintnpm run dev/gen-service (invoked automatically)/gen-hook (invoked automatically)/deploy-codeapp/fix-codeapp-issuePro Tip: Use connection references for better ALM when deploying across environments. They allow you to reconfigure connections without code changes.
npx claudepluginhub ramakrishnan24689/codeapps-toolkit --plugin codeapps-toolkitRoutes to specialized skills for adding Power Apps data sources like Dataverse (business data), SharePoint lists, Teams messages, Excel, OneDrive, and Office 365 based on user goals.
Integrates Power Pages Web API into frontend code sites for Dataverse tables, implementing API clients, CRUD operations, permissions setup, and deployment.
Foundational context for Dataverse/Dynamics 365/Power Platform: scope, tool-capability reference, safety rules, and change lifecycle. Load first for orientation on any platform task.