| name | write-app-code |
| description | USE FOR: Write app code with the generated SDK: validate exports, implement auth, and apply patterns.
DO NOT USE FOR: Non-Microsoft Graph scenarios.
INVOKES: None.
|
SDK API validation
Verify SDK exports with a minimal compiling sample (auth + one Graph call).
Write application code
- Use SDK models/methods/attributes for Graph calls; avoid raw HTTP.
- Load
references/<LANGUAGE>.md for language guidance: CSharp, Python, Typescript.
Authentication
- Use authentication provider from Azure Identity; avoid custom credential wrappers unless required.
- Mention enabling public client flows in app registration when needed.
- Docs: Authentication
Error handling and resilience
- Handle Graph-call exceptions in order:
ODataError, operational errors (filesystem, etc), then a final catch-all.
- Catch specific exception types where practical and log appropriately; do not expose raw exceptions.
CRUD Operations and Query Parameters
- Use
select to return only required properties.
- For search, prefer
POST /search/query with a complex body.
- For directory-derived resources,
$count needs an advanced query; set the ConsistencyLevel: eventual request header for subsequent pages.
- Generated query-parameter fields are not always valid per endpoint; verify supported params in the API reference.
- Docs: Query Params
Special patterns
Load Special Patterns for pagination, batching, large file uploads, delta queries, and webhooks.
Calling Patterns
| Scenario | Pattern |
|---|
| Calendar methods | startDateTime and endDateTime are required; communicate range |
| File/content download | Response is binary stream, not JSON; use stream handling |
| Teams messages | POST to channel/chat messages; include user@odata.bind in AdditionalData |