Tuesday, 20 January 2026

typescript compatibility issue in spfx

Error :  typescript compatibility issue in spfx

Below is error  when runing  gulp build command after creating a new project or upgrading project.


E:\SharePointFrameWorkDEV\ReactSPFXSolution>gulp build
Build target: DEBUG
[12:22:17] Using gulpfile E:\SharePointFrameWorkDEV\ReactSPFXSolution\gulpfile.js
[12:22:17] Starting gulp
[12:22:17] Starting 'build'...
[12:22:17] Starting subtask 'configure-sp-build-rig'...
[12:22:17] Finished subtask 'configure-sp-build-rig' after 13 ms
[12:22:17] Starting subtask 'pre-copy'...
[12:22:17] Finished subtask 'pre-copy' after 56 ms
[12:22:17] Starting subtask 'copy-static-assets'...
[12:22:17] Starting subtask 'sass'...
[12:22:17] Finished subtask 'copy-static-assets' after 93 ms
[12:22:18] Finished subtask 'sass' after 615 ms
[12:22:18] Starting subtask 'tslint'...
[12:22:20] [tslint] tslint version: 5.12.1
[12:22:20] Starting subtask 'tsc'...

[12:22:20] [tsc] typescript version: 2.7.2

[12:22:25] Error - [tsc] node_modules/@types/prop-types/index.d.ts(34,39): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/prop-types/index.d.ts(36,47): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/prop-types/index.d.ts(36,48): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/prop-types/index.d.ts(36,49): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/prop-types/index.d.ts(36,76): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/prop-types/index.d.ts(36,100): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/prop-types/index.d.ts(36,103): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/prop-types/index.d.ts(36,119): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/prop-types/index.d.ts(36,144): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/prop-types/index.d.ts(36,152): error TS1128: Declaration or statement expected.
[12:22:25] Error - [tsc] node_modules/@types/prop-types/index.d.ts(36,160): error TS1005: ',' expected.
[12:22:25] Error - [tsc] node_modules/@types/prop-types/index.d.ts(38,50): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/prop-types/index.d.ts(38,51): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/prop-types/index.d.ts(38,52): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/prop-types/index.d.ts(38,69): error TS1005: '(' expected.
[12:22:25] Error - [tsc] node_modules/@types/prop-types/index.d.ts(38,71): error TS1128: Declaration or statement expected.
[12:22:25] Error - [tsc] node_modules/@types/prop-types/index.d.ts(53,30): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/prop-types/index.d.ts(53,54): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/prop-types/index.d.ts(53,57): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(56,51): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(57,17): error TS1005: ',' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(58,25): error TS1005: '(' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(107,21): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(107,29): error TS1131: Property or signature expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(107,35): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(107,41): error TS1005: ':' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(107,55): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(107,63): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(107,67): error TS1128: Declaration or statement expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(108,5): error TS1128: Declaration or statement expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(316,50): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(316,72): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(316,75): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(715,15): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(715,29): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(717,13): error TS1005: '(' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(717,16): error TS1005: ')' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(721,15): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(721,29): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(722,17): error TS1005: ':' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(722,31): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(722,39): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(723,17): error TS1128: Declaration or statement expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(723,26): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(724,42): error TS1005: '(' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(724,71): error TS1005: '(' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(725,21): error TS1005: ',' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(726,17): error TS1005: ',' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(727,13): error TS1005: ',' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(727,16): error TS1005: ')' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(736,11): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(736,47): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(737,13): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(738,17): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(738,31): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(742,11): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(742,40): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(743,13): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(743,34): error TS1005: '(' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(744,13): error TS1005: '(' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(744,46): error TS1005: '(' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(786,56): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(786,78): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(786,86): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(787,57): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(787,84): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(787,87): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2653,31): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2655,13): error TS1005: '(' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2655,25): error TS1005: ',' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2657,13): error TS1005: '(' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2658,5): error TS1005: '(' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2658,6): error TS1005: ')' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2687,33): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2687,41): error TS1131: Property or signature expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2688,28): error TS1005: ',' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2688,38): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2689,5): error TS1128: Declaration or statement expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2728,1): error TS1128: Declaration or statement expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2732,32): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2732,43): error TS1005: ')' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2732,71): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2732,73): error TS1128: Declaration or statement expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2732,80): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2737,45): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2738,17): error TS1005: ']' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2738,18): error TS1005: ',' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2738,19): error TS1136: Property assignment expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2738,35): error TS1005: ',' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2738,38): error TS1005: ':' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2738,40): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2738,48): error TS1005: ':' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2739,13): error TS1005: ':' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2739,21): error TS1005: ':' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2739,27): error TS1005: ',' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2740,11): error TS1005: ':' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2741,9): error TS1005: ',' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2741,12): error TS1005: ':' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2742,9): error TS1005: ',' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2742,12): error TS1005: ':' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2743,39): error TS1005: '(' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2743,40): error TS1005: ')' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2749,27): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2750,14): error TS1005: ':' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2750,28): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2751,9): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2752,9): error TS1005: '(' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2753,9): error TS1005: '(' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2754,5): error TS1005: '(' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2754,12): error TS1005: ')' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2756,39): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2756,66): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2756,89): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2757,5): error TS1128: Declaration or statement expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2758,5): error TS1005: '(' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2758,9): error TS1005: ',' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2758,36): error TS1005: ',' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2758,37): error TS1005: ':' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2760,9): error TS1005: '(' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2760,13): error TS1005: ',' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2760,43): error TS1005: ',' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2760,44): error TS1005: ':' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2762,13): error TS1005: '(' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2762,16): error TS1005: ')' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2776,49): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2776,89): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2776,92): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2776,126): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2777,13): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2777,17): error TS1005: ':' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2777,57): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2777,60): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2777,94): error TS1005: ';' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2778,17): error TS1109: Expression expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2779,17): error TS1005: '(' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2780,13): error TS1005: '(' expected.
[12:22:25] Error - [tsc] node_modules/@types/react/index.d.ts(2780,43): error TS1005: '(' expected.
[12:22:25] Error - 'tsc' sub task errored after 5.38 s
 exited with code 2
[12:22:25] 'build' errored after 7.85 s
[12:22:25]
[12:22:25] ==================[ Finished ]==================
Error - [tsc] node_modules/@types/prop-types/index.d.ts(34,39): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/prop-types/index.d.ts(36,47): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/prop-types/index.d.ts(36,48): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/prop-types/index.d.ts(36,49): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/prop-types/index.d.ts(36,76): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/prop-types/index.d.ts(36,100): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/prop-types/index.d.ts(36,103): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/prop-types/index.d.ts(36,119): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/prop-types/index.d.ts(36,144): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/prop-types/index.d.ts(36,152): error TS1128: Declaration or statement expected.
Error - [tsc] node_modules/@types/prop-types/index.d.ts(36,160): error TS1005: ',' expected.
Error - [tsc] node_modules/@types/prop-types/index.d.ts(38,50): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/prop-types/index.d.ts(38,51): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/prop-types/index.d.ts(38,52): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/prop-types/index.d.ts(38,69): error TS1005: '(' expected.
Error - [tsc] node_modules/@types/prop-types/index.d.ts(38,71): error TS1128: Declaration or statement expected.
Error - [tsc] node_modules/@types/prop-types/index.d.ts(53,30): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/prop-types/index.d.ts(53,54): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/prop-types/index.d.ts(53,57): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/react/index.d.ts(56,51): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(57,17): error TS1005: ',' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(58,25): error TS1005: '(' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(107,21): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(107,29): error TS1131: Property or signature expected.
Error - [tsc] node_modules/@types/react/index.d.ts(107,35): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(107,41): error TS1005: ':' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(107,55): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/react/index.d.ts(107,63): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(107,67): error TS1128: Declaration or statement expected.
Error - [tsc] node_modules/@types/react/index.d.ts(108,5): error TS1128: Declaration or statement expected.
Error - [tsc] node_modules/@types/react/index.d.ts(316,50): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(316,72): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(316,75): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/react/index.d.ts(715,15): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(715,29): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(717,13): error TS1005: '(' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(717,16): error TS1005: ')' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(721,15): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(721,29): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(722,17): error TS1005: ':' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(722,31): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/react/index.d.ts(722,39): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(723,17): error TS1128: Declaration or statement expected.
Error - [tsc] node_modules/@types/react/index.d.ts(723,26): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(724,42): error TS1005: '(' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(724,71): error TS1005: '(' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(725,21): error TS1005: ',' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(726,17): error TS1005: ',' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(727,13): error TS1005: ',' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(727,16): error TS1005: ')' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(736,11): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(736,47): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(737,13): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/react/index.d.ts(738,17): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(738,31): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(742,11): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(742,40): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(743,13): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/react/index.d.ts(743,34): error TS1005: '(' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(744,13): error TS1005: '(' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(744,46): error TS1005: '(' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(786,56): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(786,78): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(786,86): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/react/index.d.ts(787,57): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(787,84): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(787,87): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2653,31): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2655,13): error TS1005: '(' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2655,25): error TS1005: ',' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2657,13): error TS1005: '(' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2658,5): error TS1005: '(' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2658,6): error TS1005: ')' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2687,33): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2687,41): error TS1131: Property or signature expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2688,28): error TS1005: ',' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2688,38): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2689,5): error TS1128: Declaration or statement expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2728,1): error TS1128: Declaration or statement expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2732,32): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2732,43): error TS1005: ')' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2732,71): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2732,73): error TS1128: Declaration or statement expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2732,80): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2737,45): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2738,17): error TS1005: ']' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2738,18): error TS1005: ',' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2738,19): error TS1136: Property assignment expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2738,35): error TS1005: ',' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2738,38): error TS1005: ':' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2738,40): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2738,48): error TS1005: ':' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2739,13): error TS1005: ':' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2739,21): error TS1005: ':' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2739,27): error TS1005: ',' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2740,11): error TS1005: ':' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2741,9): error TS1005: ',' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2741,12): error TS1005: ':' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2742,9): error TS1005: ',' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2742,12): error TS1005: ':' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2743,39): error TS1005: '(' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2743,40): error TS1005: ')' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2749,27): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2750,14): error TS1005: ':' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2750,28): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2751,9): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2752,9): error TS1005: '(' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2753,9): error TS1005: '(' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2754,5): error TS1005: '(' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2754,12): error TS1005: ')' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2756,39): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2756,66): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2756,89): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2757,5): error TS1128: Declaration or statement expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2758,5): error TS1005: '(' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2758,9): error TS1005: ',' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2758,36): error TS1005: ',' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2758,37): error TS1005: ':' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2760,9): error TS1005: '(' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2760,13): error TS1005: ',' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2760,43): error TS1005: ',' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2760,44): error TS1005: ':' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2762,13): error TS1005: '(' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2762,16): error TS1005: ')' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2776,49): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2776,89): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2776,92): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2776,126): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2777,13): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2777,17): error TS1005: ':' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2777,57): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2777,60): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2777,94): error TS1005: ';' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2778,17): error TS1109: Expression expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2779,17): error TS1005: '(' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2780,13): error TS1005: '(' expected.
Error - [tsc] node_modules/@types/react/index.d.ts(2780,43): error TS1005: '(' expected.
Error - 'tsc' sub task errored after 5.38 s
 exited with code 2
[12:22:26] Project student-details version:0.0.1
[12:22:26] Build tools version:3.12.1
[12:22:26] Node version:v10.14.2
[12:22:26] Total duration:15 s
[12:22:26] Task errors:138


Solution : 

1. First step to upgrade the rush stack compiler run "npm install @microsoft/rush-stack-compiler-3.2" command.
2.  open the "tsconfig.json"  and update the extend  property with the new rush stack compiler


Before 

"extends": "./node_modules/@microsoft/rush-stack-compiler-2.7/includes/tsconfig-web.json",


After update

"extends": "./node_modules/@microsoft/rush-stack-compiler-3.2/includes/tsconfig-web.json",

3. Close the file and run gulp build command 

this is the way to upgrade or downgrade the rush stack compiler in spfx

@hope problem will be resolved





Dataverse CRUD with a .NET 8 Console App using Managed Identity, DI, and Polly

Dataverse CRUD with a .NET 8 console app: this guide shows how to build a production-ready C# application that performs create, read, update, and delete operations against Microsoft Dataverse using Dependency Injection, DefaultAzureCredential, resilient retries (Polly), and clean configuration. You get copy-pasteable code, least-privilege security guidance, and optional Azure Container Apps + Key Vault deployment via azd/Bicep.

The Problem

You need a reliable way to run Dataverse CRUD from a console app without hardcoded secrets, avoiding static helpers, and ensuring the code is cloud-ready and testable. Many examples skip DI, retries, and security, leading to brittle apps.

Prerequisites

.NET 8 SDK, Azure CLI v2.58+, Azure Developer CLI (azd) v1.9+, Power Platform tooling access to create an Application User in Dataverse mapped to your app's Service Principal or Managed Identity, A Dataverse environment URL (e.g., https://yourorg.crm.dynamics.com)

The Solution (Step-by-Step)

1) Project setup and configuration

Create a new console app and add packages.

// Bash: create project and add packages
 dotnet new console -n DataverseCrud.Console --framework net8.0
 cd DataverseCrud.Console
 dotnet add package Microsoft.PowerPlatform.Dataverse.Client --version 1.1.27
 dotnet add package Azure.Identity --version 1.11.3
 dotnet add package Polly.Extensions.Http --version 3.0.0
 dotnet add package Microsoft.Extensions.Http.Polly --version 8.0.1

Add appsettings.json for configuration (no secrets).

{
  "Dataverse": {
    "OrganizationUrl": "https://yourorg.crm.dynamics.com",
    "ApiVersion": "v9.2", 
    "DefaultTableLogicalName": "account"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning"
    }
  }
}

Pro-Tip: Keep ApiVersion configurable so you can upgrade Dataverse API without code changes.

2) Implement the Generic Host with DI, typed options, and retry policies

Program.cs uses file-scoped namespaces, DI, and structured logging via Microsoft.Extensions.Logging. Polly adds resilient retries for transient failures.

using System.Net.Http.Headers;
using Azure.Core;
using Azure.Identity;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Polly;
using Polly.Extensions.Http;
using Microsoft.PowerPlatform.Dataverse.Client;

namespace DataverseCrud.ConsoleApp;

// Options record for strongly-typed config
public sealed record DataverseOptions(string OrganizationUrl, string ApiVersion, string DefaultTableLogicalName);

// Abstraction for testability
public interface IDataverseRepository
{
    // CRUD signatures using basic types for clarity
    Task<Guid> CreateAsync(string tableLogicalName, IDictionary<string, object> attributes, CancellationToken ct);
    Task<Dictionary<string, object>?> RetrieveAsync(string tableLogicalName, Guid id, string columnsCsv, CancellationToken ct);
    Task UpdateAsync(string tableLogicalName, Guid id, IDictionary<string, object> attributes, CancellationToken ct);
    Task DeleteAsync(string tableLogicalName, Guid id, CancellationToken ct);
}

// Concrete repository using ServiceClient
public sealed class DataverseRepository(IOptions<DataverseOptions> options, ILogger<DataverseRepository> logger, ServiceClient serviceClient) : IDataverseRepository
{
    private readonly DataverseOptions _opt = options.Value;
    private readonly ILogger<DataverseRepository> _logger = logger;
    private readonly ServiceClient _client = serviceClient;

    // Create a row in Dataverse
    public async Task<Guid> CreateAsync(string tableLogicalName, IDictionary<string, object> attributes, CancellationToken ct)
    {
        // Convert to Entity representation
        var entity = new Microsoft.Xrm.Sdk.Entity(tableLogicalName);
        foreach (var kvp in attributes)
            entity.Attributes[kvp.Key] = kvp.Value;

        var id = await _client.CreateAsync(entity, ct).ConfigureAwait(false);
        _logger.LogInformation("Created {Table} record with Id {Id}", tableLogicalName, id);
        return id;
    }

    // Retrieve a row with selected columns
    public async Task<Dictionary<string, object>?> RetrieveAsync(string tableLogicalName, Guid id, string columnsCsv, CancellationToken ct)
    {
        var columns = new Microsoft.Xrm.Sdk.Query.ColumnSet(columnsCsv.Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries));
        var entity = await _client.RetrieveAsync(tableLogicalName, id, columns, ct).ConfigureAwait(false);
        if (entity == null)
        {
            _logger.LogWarning("Entity not found: {Table}/{Id}", tableLogicalName, id);
            return null;
        }
        return entity.Attributes.ToDictionary(k => k.Key, v => v.Value);
    }

    // Update specific attributes
    public async Task UpdateAsync(string tableLogicalName, Guid id, IDictionary<string, object> attributes, CancellationToken ct)
    {
        var entity = new Microsoft.Xrm.Sdk.Entity(tableLogicalName) { Id = id };
        foreach (var kvp in attributes)
            entity.Attributes[kvp.Key] = kvp.Value;

        await _client.UpdateAsync(entity, ct).ConfigureAwait(false);
        _logger.LogInformation("Updated {Table} record {Id}", tableLogicalName, id);
    }

    // Delete a row
    public async Task DeleteAsync(string tableLogicalName, Guid id, CancellationToken ct)
    {
        await _client.DeleteAsync(tableLogicalName, id, ct).ConfigureAwait(false);
        _logger.LogInformation("Deleted {Table} record {Id}", tableLogicalName, id);
    }
}

public class Program
{
    public static async Task Main(string[] args)
    {
        using var host = Host.CreateApplicationBuilder(args);

        // Bind options from configuration
        host.Services.AddOptions<DataverseOptions>()
            .Bind(host.Configuration.GetSection("Dataverse"))
            .ValidateDataAnnotations()
            .Validate(opt => !string.IsNullOrWhiteSpace(opt.OrganizationUrl) && !string.IsNullOrWhiteSpace(opt.ApiVersion));

        host.Services.AddLogging(builder =>
        {
            builder.AddSimpleConsole(o =>
            {
                o.TimestampFormat = "yyyy-MM-dd HH:mm:ss ";
                o.SingleLine = true;
            });
        });

        // Configure resilient HTTP with Polly for Dataverse traffic
        host.Services.AddHttpClient("dataverse")
            .SetHandlerLifetime(TimeSpan.FromMinutes(5))
            .AddPolicyHandler(GetRetryPolicy());

        // Register ServiceClient using DefaultAzureCredential (prefers Managed Identity in Azure)
        host.Services.AddSingleton(sp =>
        {
            var opts = sp.GetRequiredService<IOptions<DataverseOptions>>().Value;
            var credential = new DefaultAzureCredential(new DefaultAzureCredentialOptions
            {
                // In production on Azure Container Apps/VMs, Managed Identity will be used.
                // Locally, DeveloperCredential/VisualStudioCredential will be used.
                ExcludeManagedIdentityCredential = false
            });

            var svc = new ServiceClient(new Uri(opts.OrganizationUrl), credential, useUniqueInstance: true, useWebApi: true);
            // Configure ServiceClient API version if supported/necessary by environment
            svc.SdkVersion = opts.ApiVersion; // Documented: keep version configurable
            return svc;
        });

        host.Services.AddSingleton<IDataverseRepository, DataverseRepository>();

        var app = host.Build();

        // Execute a CRUD flow
        var logger = app.Services.GetRequiredService<ILogger<Program>>();
        var repo = app.Services.GetRequiredService<IDataverseRepository>();
        var cfg = app.Services.GetRequiredService<IOptions<DataverseOptions>>().Value;

        using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(2));

        try
        {
            // 1) Create
            var accountId = await repo.CreateAsync(cfg.DefaultTableLogicalName, new Dictionary<string, object>
            {
                ["name"] = "Contoso (Console App)",
                ["telephone1"] = "+1-425-555-0100"
            }, cts.Token);

            // 2) Retrieve
            var data = await repo.RetrieveAsync(cfg.DefaultTableLogicalName, accountId, "name,telephone1", cts.Token);
            logger.LogInformation("Retrieved: {Data}", string.Join("; ", data!.Select(kv => $"{kv.Key}={kv.Value}")));

            // 3) Update
            await repo.UpdateAsync(cfg.DefaultTableLogicalName, accountId, new Dictionary<string, object>
            {
                ["telephone1"] = "+1-425-555-0101"
            }, cts.Token);

            // 4) Delete
            await repo.DeleteAsync(cfg.DefaultTableLogicalName, accountId, cts.Token);

            logger.LogInformation("CRUD flow completed successfully.");
        }
        catch (Exception ex)
        {
            logger.LogError(ex, "Failure during CRUD flow");
            Environment.ExitCode = 1;
        }

        await app.StopAsync();
    }

    // Exponential backoff for transient HTTP 5xx/429 responses
    private static IAsyncPolicy<HttpResponseMessage> GetRetryPolicy() =>
        HttpPolicyExtensions
            .HandleTransientHttpError()
            .OrResult(r => (int)r.StatusCode == 429)
            .WaitAndRetryAsync(5, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
}

Pro-Tip: Add structured properties to logs (e.g., table, id) for easier querying in Application Insights.

3) Dataverse authentication without secrets

The ServiceClient uses DefaultAzureCredential, which in Azure will use Managed Identity. In local development, it falls back to developer credentials. You must create an Application User in Dataverse mapped to the Service Principal or Managed Identity and assign the least-privilege Dataverse security role needed for CRUD on targeted tables.

Pro-Tip: Scope Dataverse privileges to only the tables and operations your app requires.

4) Optional: Run in Azure Container Apps with Managed Identity (IaC via azd/Bicep)

If you want to run this console app on a schedule or on-demand in Azure, deploy to Azure Container Apps with a System-Assigned Managed Identity. Use Key Vault to hold non-secret config like OrganizationUrl and ApiVersion for central governance.

// azure.yaml for azd (simplified)
name: dataverse-crud
metadata:
  template: dataverse-crud
services:
  app:
    project: ./
    language: dotnet
    host: containerapp
    docker:
      path: ./Dockerfile
      context: ./

// main.bicep (simplified): Container App + Key Vault + MI and RBAC
param location string = resourceGroup().location
param appName string = 'dataverse-crud-app'
param kvName string = 'dvcrud-kv-${uniqueString(resourceGroup().id)}'

resource kv 'Microsoft.KeyVault/vaults@2023-07-01' = {
  name: kvName
  location: location
  properties: {
    tenantId: subscription().tenantId
    sku: { family: 'A', name: 'standard' }
    accessPolicies: [] // Use RBAC rather than access policies
    enableRbacAuthorization: true
  }
}

resource caEnv 'Microsoft.App/managedEnvironments@2023-05-01' = {
  name: 'dvcrud-env'
  location: location
}

resource app 'Microsoft.App/containerApps@2023-05-01' = {
  name: appName
  location: location
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    managedEnvironmentId: caEnv.id
    template: {
      containers: [
        {
          name: 'app'
          image: 'ghcr.io/yourrepo/dataverse-crud:latest'
          env: [
            // Pull configuration from Key Vault via secrets or set as plain env if non-secret
            { name: 'Dataverse__OrganizationUrl', value: 'https://yourorg.crm.dynamics.com' },
            { name: 'Dataverse__ApiVersion', value: 'v9.2' },
            { name: 'Dataverse__DefaultTableLogicalName', value: 'account' }
          ]
        }
      ]
    }
  }
}

// Grant the Container App's Managed Identity access to Key Vault secrets if used for configuration
resource kvAccess 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
  name: guid(kv.id, 'kv-secrets-user', app.name)
  scope: kv
  properties: {
    roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '4633458b-17de-408a-b874-0445c86b69e6') // Key Vault Secrets User
    principalId: app.identity.principalId
    principalType: 'ServicePrincipal'
  }
}

Azure RBAC roles used here: Key Vault Secrets User on the vault to read secrets if you store any configuration as secrets. The Container App requires no additional Azure RBAC to call Dataverse; it authenticates via its Managed Identity to Entra ID, and Dataverse access is governed by the Application User and Dataverse security role assignments.

Pro-Tip: Prefer System-Assigned Managed Identity for lifecycle simplicity unless you need identity reuse across apps, in which case use a User-Assigned Managed Identity.

5) Testing and mocking

Abstract your repository behind IDataverseRepository to unit test business logic without hitting Dataverse. For integration tests, use a test environment with a restricted Dataverse security role.

// Example unit test using a fake repository
public sealed class FakeRepo : IDataverseRepository
{
    public List<string> Calls { get; } = new();
    public Task<Guid> CreateAsync(string t, IDictionary<string, object> a, CancellationToken ct) { Calls.Add("create"); return Task.FromResult(Guid.NewGuid()); }
    public Task<Dictionary<string, object>?> RetrieveAsync(string t, Guid id, string cols, CancellationToken ct) { Calls.Add("retrieve"); return Task.FromResult<Dictionary<string, object>?>(new()); }
    public Task UpdateAsync(string t, Guid id, IDictionary<string, object> a, CancellationToken ct) { Calls.Add("update"); return Task.CompletedTask; }
    public Task DeleteAsync(string t, Guid id, CancellationToken ct) { Calls.Add("delete"); return Task.CompletedTask; }
}

Pro-Tip: Use dependency injection to pass a fake or mock implementation into services that depend on IDataverseRepository.

Best Practices & Security

Authentication and secrets: Use DefaultAzureCredential. Do not embed client secrets or connection strings. In Azure, rely on Managed Identity. Locally, authenticate via developer credentials.

Dataverse permissions: Assign a least-privilege Dataverse security role to the Application User (e.g., CRUD on specific tables only). Avoid granting environment-wide privileges.

Azure RBAC: If using Key Vault, grant only the Key Vault Secrets User role to the app’s Managed Identity. Do not grant Owner or Contributor without justification.

Resilience: The Polly retry policy handles 5xx/429 responses with exponential backoff; tune retry counts/timeouts per SLOs.

Observability: Use Microsoft.Extensions.Logging with structured state for IDs and table names. Forward logs to Application Insights via the built-in provider when running in Azure.

Configuration hygiene: Keep OrganizationUrl, ApiVersion, and default table logical names in configuration. Validate options at startup.

Token reuse: DefaultAzureCredential and underlying token providers cache tokens. Avoid recreating credentials per request; register ServiceClient as a singleton as shown.

Pro-Tip: For read-only operations at scale, prefer the Web API with select columns and server-side paging; avoid retrieving full records when not needed.

Summary

• You built a .NET 8 console app that performs Dataverse CRUD using DI, DefaultAzureCredential, and Polly retries.

• Security is hardened with Managed Identity, least-privilege Dataverse roles, and optional Azure RBAC for Key Vault.

• The solution is production-ready, testable, and configurable, with an optional path to deploy on Azure Container Apps via azd/Bicep.

Next step: map your Managed Identity or app registration to a Dataverse Application User, assign a minimal security role, and run the CRUD flow against your target tables.


Monday, 19 January 2026

How to Get User Detail Programatically on ListItem Field

How to Get SPUser Detail Programatically on ListItem Field




 using (SPSite site = new SPSite("http://servername/"))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    SPList List=web.Lists["Voucher"];
                   foreach(SPListItem ListItem in List.Items)
                   {
                       SPFieldUser ownerField =ListItem.Fields.GetField("ColumnName") as SPFieldUser;
                       SPFieldUserValue ownerValue = ownerField.GetFieldValue(ListItem[ownerField.Id].ToString()) as SPFieldUserValue;
                       SPUser owner = ownerValue.User;
                       string ownersEmail = owner.Email;
                       Console.WriteLine("user Name"+ListItem["ColumnName"].ToString());
                       Console.WriteLine("Users Email Id....."+ownersEmail.ToString());
                       Console.WriteLine("User Name .........." + owner.Name);
                       Console.WriteLine("User Id ............." + owner.ID);
                       Console.WriteLine("User Login........." + owner.LoginName);
                   
                       Console.Read();
                   }
                }
            }

Delete All item from sharepoint list using console application

Delete All item from  sharepoint on premise list using console application



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;

namespace DeleteAllitem
{
    class Program
    {
        static void Main(string[] args)
        {
            using (SPSite site = new SPSite("http://win-0c3p6kepvck:100/kkk/"))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    SPList list = web.Lists["Department"];
                    int intcount = list.ItemCount;
                    for (int i = 0; i < intcount; i++)
                    {
                        list.Items.Delete(i);
                        Console.WriteLine("item deleted"+i.ToString());
                    }
                }
            }
        }
    }
}







How to Add Users to a group



Console.WriteLine("Enter a ; delimited list of domain\alias that need to be added:");
            string sAliases = Console.ReadLine(); //captures whatever the user entered
     
            string sAllContacts = "";

            using (SPSite site = new SPSite("http://win-0c3p6kepvck:100/kkk/"))
            {
                site.AllowUnsafeUpdates = true;
                using (SPWeb web = site.OpenWeb())
                {
                    web.AllowUnsafeUpdates = true;
                    string[] aAliases = sAliases.Split(';');
                    foreach (string sAlias in aAliases)
                    {
                        SPUser user = web.EnsureUser(sAlias);

                        sAllContacts += user.ID.ToString() + ";#" + user.LoginName.ToString() + ";#";
                        if (sAllContacts.EndsWith(";#"))
                        {
                            sAllContacts = sAllContacts.Substring(0, sAllContacts.Length - 2);
                        }
                        SPList list = web.Lists["DemoList"];
                        SPListItem li = list.Items.Add();
                        li["Title"] = "jhjh";
                        li["parent"] = sAllContacts;
                        li["dname"] = sAllContacts;
                        li.Update();
                        Console.WriteLine("Done");
                    }
                    web.Update();

                }
            }

What Is SharePoint Subscription Edition? A Practical Guide for IT and Business Teams

What Is SharePoint Subscription Edition?

SharePoint Subscription Edition is Microsoft’s continuously updated, on-premises version of SharePoint Server delivered via a subscription licensing model. Unlike traditional major-version releases, it follows an evergreen approach with regular feature, security, and reliability updates, letting organizations keep content and custom solutions on-premises while integrating with select Microsoft 365 cloud services for hybrid scenarios.

Key Capabilities and Advantages

  • Evergreen on-premises: Receive ongoing updates without waiting years for new major versions.
  • Modern authentication: Support for contemporary auth standards (e.g., OpenID Connect/OAuth) to improve security and interoperability.
  • Hardened security posture: Compatibility with newer protocols and ciphers (such as TLS 1.3 where supported) and modern admin controls.
  • Hybrid flexibility: Connect on-premises sites to Microsoft 365 services like search, OneDrive redirection, or hybrid taxonomy to bridge cloud and datacenter.
  • Enterprise scalability: Farm-based architecture, service applications, and role-based topology help support large, mission-critical workloads.
  • Customization support: Continue using farm solutions, apps, and extensibility patterns appropriate for your environment and governance model.

Licensing and Support at a Glance

  • Subscription-based model: Predictable costs, entitlement to ongoing updates, and simplified planning for upgrades.
  • Regular cumulative updates: Security and feature improvements delivered through a structured cadence for better stability.
  • Feature eligibility: Some enhancements may depend on your Windows Server/SQL Server versions and farm configuration.

When to Choose SharePoint Subscription Edition

  • Regulatory or data residency needs: Keep sensitive content on-premises to meet compliance, audit, or sovereignty requirements.
  • Highly customized solutions: Maintain server-side customizations or integrations that aren’t feasible in the cloud.
  • Hybrid-first strategy: Use on-premises for line-of-business content while leveraging Microsoft 365 for collaboration or external sharing.
  • Network constraints: Provide low-latency access for users or plants with limited internet connectivity.

Architecture and Requirements (High-Level)

  • Farm roles: Web front ends, application servers, and database tier (SQL Server) aligned with capacity and performance goals.
  • Identity & authentication: Integration with Active Directory; support for modern auth protocols for secure SSO scenarios.
  • Networking & security: Enforce HTTPS by default, modern cipher suites, and strict certificate management.
  • High availability: Load balancing on web/app tiers and database HA (e.g., Always On availability groups) for resilience.

Example Migration Path (From SharePoint Server 2016/2019)

  • Step 1: Inventory & assessment. Audit site collections, service apps, custom solutions, and third-party add-ons.
  • Step 2: Clean-up & modernization. Remove unused sites, retire legacy customizations, and plan modern auth adoption.
  • Step 3: Build new SE farm. Prepare new servers, install prerequisites, and configure a dedicated SharePoint Subscription Edition farm.
  • Step 4: Database attach upgrade. Back up content and service application databases from the source farm, restore to the new SQL instance, and attach to the SE farm.
  • Step 5: Validate & optimize. Test search, user profiles, workflows, and custom code; tune performance and implement HA.
  • Step 6: Cutover & post-go-live. Switch DNS, monitor health, finalize documentation, and schedule ongoing update cadence.

Real-World Examples

  • Manufacturing enterprise: Keeps plant documentation and SOPs on-premises for low-latency access while using Microsoft 365 for company-wide collaboration.
  • Financial services: Hosts regulated records in a locked-down datacenter with strict auditing while enabling secure external sharing through a hybrid approach.
  • Public sector: Meets sovereignty requirements by storing data locally, integrating with modern identity providers for secure sign-on.

Best Practices for a Successful Deployment

  • Adopt a regular update schedule: Plan, test, and apply cumulative updates to stay secure and supported.
  • Harden security baselines: Enforce HTTPS, modern TLS, least-privileged service accounts, and MFA through compatible identity solutions.
  • Capacity planning: Right-size web/app servers and SQL resources; monitor with health analytics and logging.
  • Governance & lifecycle: Define site provisioning, retention, and archival policies; standardize customization review.
  • Hybrid where it helps: Offload non-sensitive workloads or external sharing to Microsoft 365 to reduce on-premises overhead.

Frequently Asked Questions

  • Is SharePoint Subscription Edition cloud-based? No. It’s an on-premises product that can integrate with select Microsoft 365 services in hybrid configurations.
  • Do I need to upgrade again later? The evergreen model delivers ongoing updates, reducing the need for disruptive, major-version migrations.
  • Can I keep my custom solutions? Yes, provided they are compatible and follow supported development and security practices.
  • What about Project Server? Project Server capabilities are available in the same installation footprint, subject to proper licensing and configuration.

Conclusion

SharePoint Subscription Edition provides an evergreen, secure, and flexible path for organizations that must run SharePoint on-premises while benefiting from modern identity, hybrid connectivity, and continuous improvements. With sound governance, regular updates, and careful capacity planning, it can power content management and intranet scenarios at enterprise scale.

Dataverse Benefits and Its Core Features: The Complete Guide for Power Platform Success

What Is Microsoft Dataverse?

Understanding Dataverse benefits and its core features is essential for building secure, scalable business apps on the Microsoft Power Platform. Dataverse is a cloud data platform that lets you store, manage, and securely share structured data across Power Apps, Power Automate, Power Pages, and beyond.

Top Dataverse Benefits

  • Unified data layer: Standardize data with the Common Data Model so apps speak a common language.
  • Enterprise-grade security: Role-based access control, row-level security, and field-level protection keep sensitive data safe.
  • Scalability and performance: Optimized storage, indexing, and server-side logic for high-volume workloads.
  • Low-code acceleration: Build apps faster with tables, relationships, and business rules—without deep database expertise.
  • Microsoft 365 and Dynamics 365 synergy: Natively integrates with familiar tools like Teams, Excel, and Dynamics 365.
  • Governance and compliance: Data loss prevention (DLP), auditing, and region-aware storage help meet compliance needs.
  • Extensible and open: Connect via APIs, virtual tables, and connectors to systems inside and outside Microsoft’s ecosystem.

Core Features of Dataverse

Structured Data with Tables, Columns, and Relationships

Dataverse organizes information into tables (standard or custom) with rich data types like text, number, date, currency, file, and image. You can define one-to-many and many-to-many relationships to model real-world scenarios.

Business Rules, Logic, and Validation

Create server-side rules to validate data, auto-calculate fields, and enforce policies. Use business process flows to guide users through standardized steps for consistent outcomes.

Advanced Security Model

Use role-based security to control access by table, privilege, and scope. Apply row-level and field-level security to protect sensitive records or fields such as salaries or PII.

Common Data Model (CDM)

Leverage standard, well-defined entities (e.g., Account, Contact) to accelerate solution design and ensure interoperability across apps.

Files, Images, and Large Data Support

Attach files and store images directly in Dataverse with appropriate storage tiers, enabling richer app experiences.

Integration, APIs, and Connectors

Access RESTful Web APIs, use virtual tables to read from external systems in real time, and connect with hundreds of services through Power Platform connectors.

Auditing, Logging, and Monitoring

Track changes to records for compliance and troubleshooting, and monitor performance with environment analytics.

Managed Solutions and ALM

Package and move apps, tables, and flows between environments using solutions to support robust application lifecycle management.

Examples: How Teams Use Dataverse

  • Sales pipeline management: Use standard Account and Opportunity tables, add custom fields, and enforce a business process flow from lead to close.
  • Service ticketing: Store Cases with relationships to Customers and Products, trigger Power Automate flows for escalations, and secure sensitive notes with field security.
  • Supplier onboarding: Build a portal with Power Pages connected to Dataverse tables, validate vendor data with business rules, and audit all updates.

When to Choose Dataverse

  • Need enterprise security with granular permissions and auditing.
  • Require rapid app development across Power Apps and Power Automate.
  • Expect growth in data volume, users, or complexity.
  • Depend on Microsoft ecosystem like Dynamics 365, Teams, and Microsoft 365.

Best Practices for Success

  • Design a data model first: Identify tables, keys, and relationships before building apps.
  • Use standard tables when possible: Start with CDM entities to improve compatibility.
  • Secure by design: Define roles, row-level security, and DLP policies early.
  • Automate logic on the server: Prefer business rules and flows for consistent enforcement.
  • Plan for ALM: Use solutions, versioning, and multiple environments (dev, test, prod).

Getting Started

Create an environment, define your tables and relationships, set security roles, and build a model-driven or canvas app. Connect your flows for automation, and publish solutions for repeatable deployment.

Sunday, 18 January 2026

SharePoint vs SharePoint Embedded: Key Differences, Use Cases, and How to Choose

SharePoint vs SharePoint Embedded: What’s the Difference?

SharePoint vs SharePoint Embedded is a common comparison for teams deciding between a full-featured collaboration hub and a headless content platform for custom apps. While both rely on Microsoft’s trusted content backbone, they serve different needs: SharePoint delivers out-of-the-box sites, lists, and document libraries, whereas SharePoint Embedded provides API-first content services to power your own applications.

Overview and Core Concepts

SharePoint is a comprehensive content and collaboration solution for intranets, team sites, document management, and knowledge sharing. It offers UI-ready features like sites, pages, web parts, permissions, search, and workflows.

SharePoint Embedded is a headless, developer-centric offering that exposes content storage, security, and compliance via APIs. It lets you integrate enterprise-grade content capabilities into custom apps without deploying traditional SharePoint sites.

Feature Comparison at a Glance

  • Interface: SharePoint includes a rich, configurable UI; SharePoint Embedded is API-first with no end-user UI.
  • Customization: SharePoint supports low-code and site-level customization; SharePoint Embedded supports deep, code-first integration in your own app experiences.
  • Collaboration: SharePoint provides document libraries, co-authoring, and pages; SharePoint Embedded focuses on content services (files, metadata, permissions) for app scenarios.
  • Governance and Security: Both leverage Microsoft 365 security, compliance, and permission models; SharePoint Embedded lets you enforce these controls programmatically in custom apps.
  • Deployment Speed: SharePoint offers rapid setup with ready-made sites; SharePoint Embedded requires development effort but yields tailored experiences.

When to Choose SharePoint

Pick SharePoint when you need an enterprise intranet, team collaboration, document management with versioning, and content publishing—without building from scratch.

  • Intranet and Communication Portals: Launch company news, policies, and departmental pages quickly.
  • Team Collaboration: Use document libraries, lists, and co-authoring to manage projects.
  • Knowledge Hubs: Create structured repositories with search and taxonomy.
  • Low-Code Solutions: Combine SharePoint with Power Platform to automate processes without heavy development.

When to Choose SharePoint Embedded

Pick SharePoint Embedded when you’re building bespoke applications that need secure, compliant content services but not SharePoint’s UI.

  • Custom Line-of-Business Apps: Store and manage files (contracts, designs, reports) within your own UI.
  • ISV/SaaS Scenarios: Embed enterprise-grade content storage for customers while maintaining tenant isolation and compliance.
  • Mobile and Multiplatform Experiences: Deliver consistent content features across web, mobile, and desktop via APIs.
  • Granular Control: Programmatically manage permissions, lifecycle, and metadata aligned to your domain model.

Practical Examples

Example 1: HR Intranet vs HR Case App

SharePoint: Build an HR portal with policies, onboarding pages, and a document library for templates—launched quickly with minimal custom code.

SharePoint Embedded: Build an HR case management app where case files, notes, and attachments are stored via APIs with strict permission models per case.

Example 2: Project Collaboration vs Engineering File Service

SharePoint: Create project sites with document libraries, task lists, and integrated co-authoring for cross-team collaboration.

SharePoint Embedded: Power an engineering app that programmatically stores design files, enforces role-based access, and tags metadata for lifecycle workflows.

Example 3: Knowledge Base vs Multi-Tenant SaaS Content Layer

SharePoint: Publish FAQs, guides, and SOPs with navigation, search, and permissions out of the box.

SharePoint Embedded: Provide a multi-tenant SaaS with isolated customer content, auditable access, and retention policies—all controlled via APIs.

Decision Criteria

  • Speed to Value: Need a turnkey portal? Choose SharePoint. Need custom UX with tight integration? Choose SharePoint Embedded.
  • Development Resources: Limited dev capacity favors SharePoint; engineering-heavy teams may prefer SharePoint Embedded.
  • User Experience Control: SharePoint gives configurable UI; SharePoint Embedded gives full UI ownership.
  • Scalability and Multi-Tenancy: SharePoint Embedded can simplify content isolation for multi-tenant apps.
  • Compliance and Security: Both inherit enterprise-grade controls; choose based on whether you need UI-ready governance or code-driven enforcement.

Cost and Operations Considerations

SharePoint typically aligns with Microsoft 365 licensing and offers rapid deployment with predictable admin overhead. SharePoint Embedded emphasizes consumption via APIs and may optimize cost for app-centric workloads where you pay based on usage patterns. Evaluate total cost by factoring development time, hosting, API usage, administration, and support.

Migration and Coexistence Strategy

These services can coexist. Many organizations run their intranet on SharePoint while building specialized apps on SharePoint Embedded. Start with centralized governance and information architecture, define metadata and retention, then integrate search and security groups to avoid duplication.

Summary: Which One Is Right for You?

If you want a robust collaboration hub with minimal coding, choose SharePoint. If you need to embed secure, compliant content capabilities within custom apps and retain full control over the UI and logic, choose SharePoint Embedded. In many cases, a hybrid approach delivers the best of both worlds.

Integrate Power Apps with AI using Azure Functions (.NET 8) and Azure OpenAI with Managed Identity

Integrate Power Apps with AI by fronting Azure OpenAI behind a secure .NET 8 isolated Azure Function, authenticated via Entra ID and deployed with Azure Bicep. Why this matters: you keep your Azure OpenAI keyless via Managed Identity, enforce RBAC, and provide a stable HTTPS endpoint for Power Apps using a custom connector.

The Problem

Developers need to call AI securely from Power Apps without exposing keys, while meeting enterprise requirements for RBAC, observability, and least-privilege. Manual wiring through the portal and ad hoc security checks lead to drift and risk.

Prerequisites

  • Azure CLI 2.60+
  • .NET 8 SDK
  • Azure Developer CLI (optional) or Bicep CLI
  • Owner or User Access Administrator on the target subscription
  • Power Apps environment access for creating a custom connector

The Solution (Step-by-Step)

1) Deploy Azure resources with Bicep (Managed Identity, Function App, Azure OpenAI, RBAC, Easy Auth)

This Bicep template creates a Function App with system-assigned managed identity, Azure OpenAI with a model deployment, App Service Authentication (Easy Auth) enforced, and assigns the Cognitive Services OpenAI User role to the identity.

// main.bicep
targetScope = 'resourceGroup'

@description('Name prefix for resources')
param namePrefix string

@description('Location for resources')
param location string = resourceGroup().location

@description('Azure OpenAI model name, e.g., gpt-4o-mini')
param aoaiModelName string = 'gpt-4o-mini'

@description('Azure OpenAI model version for your region (see Azure docs for supported versions).')
param aoaiModelVersion string = '2024-07-18' // Tip: Validate the correct version via az cognitiveservices account list-models

var funcName = '${namePrefix}-func'
var aoaiName = '${namePrefix}-aoai'
var hostingPlanName = '${namePrefix}-plan'
var appInsightsName = '${namePrefix}-ai'
var storageName = toLower(replace('${namePrefix}st${uniqueString(resourceGroup().id)}', '-', ''))

resource storage 'Microsoft.Storage/storageAccounts@2023-05-01' = {
  name: storageName
  location: location
  sku: {
    name: 'Standard_LRS'
  }
  kind: 'StorageV2'
}

resource appInsights 'Microsoft.Insights/components@2020-02-02' = {
  name: appInsightsName
  location: location
  kind: 'web'
  properties: {
    Application_Type: 'web'
  }
}

resource plan 'Microsoft.Web/serverfarms@2023-12-01' = {
  name: hostingPlanName
  location: location
  sku: {
    name: 'Y1' // Consumption for Functions
    tier: 'Dynamic'
  }
}

resource func 'Microsoft.Web/sites@2023-12-01' = {
  name: funcName
  location: location
  kind: 'functionapp'
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    serverFarmId: plan.id
    siteConfig: {
      appSettings: [
        { name: 'AzureWebJobsStorage', value: storage.listKeys().keys[0].value }
        { name: 'APPLICATIONINSIGHTS_CONNECTION_STRING', value: appInsights.properties.ConnectionString }
        { name: 'FUNCTIONS_EXTENSION_VERSION', value: '~4' }
        { name: 'FUNCTIONS_WORKER_RUNTIME', value: 'dotnet-isolated' }
        // Enable Easy Auth enforcement via config below (authSettingsV2)
      ]
      http20Enabled: true
      minimumTlsVersion: '1.2'
      ftpsState: 'Disabled'
      cors: {
        allowedOrigins: [
          // Add your Power Apps domain if needed; CORS is typically managed by the custom connector
        ]
      }
    }
    httpsOnly: true
  }
}

// Enable App Service Authentication (Easy Auth) with Entra ID and enforce authentication.
resource auth 'Microsoft.Web/sites/config@2023-12-01' = {
  name: '${func.name}/authsettingsV2'
  properties: {
    globalValidation: {
      requireAuthentication: true
      unauthenticatedClientAction: 'Return401'
    }
    identityProviders: {
      azureActiveDirectory: {
        enabled: true
        registration: {
          // When omitted, system can use an implicit provider. For enterprise, specify a registered app:
          // Provide clientId and clientSecretSettingName if using a dedicated app registration.
        }
        validation: {
          // Audience (App ID URI or application ID). Power Apps custom connector should request this audience.
          // Replace with your API application ID URI when using a dedicated AAD app registration.
          allowedAudiences: [
            'api://<your-app-id>'
          ]
        }
        login: {
          disableWWWAuthenticate: false
        }
      }
    }
    platform: {
      enabled: true
      runtimeVersion: '~1'
    }
    login: {
      tokenStore: {
        enabled: true
      }
    }
  }
}

// Azure OpenAI account
resource aoai 'Microsoft.CognitiveServices/accounts@2023-05-01' = {
  name: aoaiName
  location: location
  kind: 'OpenAI'
  sku: {
    name: 'S0'
  }
  properties: {
    customSubDomainName: toLower(aoaiName)
    publicNetworkAccess: 'Enabled'
  }
}

// Azure OpenAI deployment - ensure model/version are valid for your region
resource aoaiDeployment 'Microsoft.CognitiveServices/accounts/deployments@2023-05-01' = {
  name: 'chat-${aoaiModelName}'
  parent: aoai
  properties: {
    model: {
      format: 'OpenAI'
      name: aoaiModelName
      version: aoaiModelVersion
    }
    capacities: [
      {
        capacity: 1
        capacityType: 'Standard'
      }
    ]
  }
}

// Assign RBAC: Cognitive Services OpenAI User role to the Function's managed identity
// Built-in role: Cognitive Services OpenAI User (Role ID: 5e0bd9bd-7ac1-4c9e-8289-1b01f135d4a8)
resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
  name: guid(aoai.id, func.identity.principalId, 'CognitiveServicesOpenAIUserRole')
  scope: aoai
  properties: {
    roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '5e0bd9bd-7ac1-4c9e-8289-1b01f135d4a8')
    principalId: func.identity.principalId
    principalType: 'ServicePrincipal'
  }
}

output functionAppName string = func.name
output openAiEndpoint string = 'https://${aoai.name}.openai.azure.com/'
output openAiDeployment string = aoaiDeployment.name

Tip: To find the correct model version for your region, run: az cognitiveservices account list-models --name <aoaiName> --resource-group <rg> --output table.

2) Implement a secure .NET 8 isolated Azure Function with DI and Managed Identity

The function validates Entra ID via Easy Auth headers, performs input validation, calls Azure OpenAI using DefaultAzureCredential, and returns a minimal response. AuthorizationLevel is Anonymous because App Service Authentication is enforcing auth at the edge; the code still verifies identity defensively.

// Program.cs
using System.Text.Json;
using Azure;
using Azure.AI.OpenAI;
using Azure.Identity;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Middleware;
using Microsoft.Azure.Functions.Worker.Extensions.OpenApi.Extensions;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

var host = new HostBuilder()
    .ConfigureFunctionsWebApplication(builder =>
    {
        // Add global middleware if needed (e.g., correlation, exception handling)
        builder.UseMiddleware<GlobalExceptionMiddleware>();
    })
    .ConfigureServices((ctx, services) =>
    {
        var config = ctx.Configuration;

        // Bind custom options
        services.Configure<OpenAIOptions>(config.GetSection(OpenAIOptions.SectionName));

        // Register OpenAI client using Managed Identity (no keys)
        services.AddSingleton((sp) =>
        {
            var options = sp.GetRequiredService<Microsoft.Extensions.Options.IOptions<OpenAIOptions>>().Value;
            // Use DefaultAzureCredential to leverage Managed Identity in Azure
            var credential = new DefaultAzureCredential();
            return new OpenAIClient(new Uri(options.Endpoint), credential);
        });

        services.AddSingleton<IPromptService, PromptService>();
        services.AddApplicationInsightsTelemetryWorkerService();
    })
    .ConfigureAppConfiguration(config =>
    {
        config.AddEnvironmentVariables();
    })
    .ConfigureLogging(logging =>
    {
        logging.AddConsole();
    })
    .Build();

await host.RunAsync();

file sealed class GlobalExceptionMiddleware : IFunctionsWorkerMiddleware
{
    public async Task Invoke(FunctionContext context, FunctionExecutionDelegate next)
    {
        try
        {
            await next(context);
        }
        catch (Exception ex)
        {
            var logger = context.GetLogger<GlobalExceptionMiddleware>();
            logger.LogError(ex, "Unhandled exception");

            // Avoid leaking internals; return generic error with correlation ID
            var invocationId = context.InvocationId;
            var http = await context.GetHttpRequestDataAsync();
            if (http is not null)
            {
                var response = http.CreateResponse(System.Net.HttpStatusCode.InternalServerError);
                await response.WriteStringAsync($"Request failed. CorrelationId: {invocationId}");
                context.GetInvocationResult().Value = response;
            }
        }
    }
}

file sealed class OpenAIOptions
{
    public const string SectionName = "OpenAI";
    public string Endpoint { get; init; } = string.Empty; // e.g., https://<aoaiName>.openai.azure.com/
    public string Deployment { get; init; } = string.Empty; // e.g., chat-gpt-4o-mini
}

// Service abstraction to keep function logic clean
file interface IPromptService
{
    Task<string> CreateChatResponseAsync(string userInput, CancellationToken ct);
}

file sealed class PromptService(OpenAIClient client, Microsoft.Extensions.Options.IOptions<OpenAIOptions> opts, ILogger<PromptService> logger) : IPromptService
{
    private readonly OpenAIClient _client = client;
    private readonly OpenAIOptions _opts = opts.Value;
    private readonly ILogger<PromptService> _logger = logger;

    public async Task<string> CreateChatResponseAsync(string userInput, CancellationToken ct)
    {
        // Basic input trimming and minimal length check
        var prompt = (userInput ?? string.Empty).Trim();
        if (prompt.Length < 3)
        {
            return "Input too short.";
        }

        // Create chat completion with minimal system prompt
        var req = new ChatCompletionsOptions()
        {
            DeploymentName = _opts.Deployment,
            Temperature = 0.2f,
            MaxTokens = 256
        };
        req.Messages.Add(new ChatRequestSystemMessage("You are a concise assistant.")); // Guardrail
        req.Messages.Add(new ChatRequestUserMessage(prompt));

        _logger.LogInformation("Calling Azure OpenAI deployment {Deployment}", _opts.Deployment);

        var resp = await _client.GetChatCompletionsAsync(req, ct);
        var msg = resp.Value.Choices.Count > 0 ? resp.Value.Choices[0].Message.Content[0].Text : "No response.";
        return msg ?? string.Empty;
    }
}
// HttpFunction.cs
using System.Net;
using System.Security.Claims;
using System.Text;
using System.Text.Json;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

namespace Api;

public sealed class ChatRequest
{
    // Strongly typed DTO for request validation
    public string Prompt { get; init; } = string.Empty;
}

public sealed class ChatFunction(IPromptService promptService, ILogger<ChatFunction> logger) 
{
    // Simple helper to read Easy Auth principal header safely
    private static ClaimsPrincipal? TryGetPrincipal(HttpRequestData req)
    {
        // Easy Auth sets x-ms-client-principal as Base64 JSON
        if (!req.Headers.TryGetValues("x-ms-client-principal", out var values)) return null;
        var b64 = values.FirstOrDefault();
        if (string.IsNullOrWhiteSpace(b64)) return null;

        try
        {
            var json = Encoding.UTF8.GetString(Convert.FromBase64String(b64));
            using var doc = JsonDocument.Parse(json);
            var claims = new List<Claim>();
            if (doc.RootElement.TryGetProperty("claims", out var arr))
            {
                foreach (var c in arr.EnumerateArray())
                {
                    var typ = c.GetProperty("typ").GetString() ?? string.Empty;
                    var val = c.GetProperty("val").GetString() ?? string.Empty;
                    claims.Add(new Claim(typ, val));
                }
            }
            return new ClaimsPrincipal(new ClaimsIdentity(claims, "EasyAuth"));
        }
        catch
        {
            return null;
        }
    }

    [Function("chat")]
    public async Task<HttpResponseData> Run(
        [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "chat")] HttpRequestData req,
        FunctionContext context)
    {
        var principal = TryGetPrincipal(req);
        if (principal is null)
        {
            // Defense in depth: App Service auth should already block, but we double-check.
            var unauth = req.CreateResponse(HttpStatusCode.Unauthorized);
            await unauth.WriteStringAsync("Authentication required.");
            return unauth;
        }

        // Basic content-type check and bound read limit
        if (!req.Headers.TryGetValues("Content-Type", out var ct) || !ct.First().Contains("application/json", StringComparison.OrdinalIgnoreCase))
        {
            var bad = req.CreateResponse(HttpStatusCode.BadRequest);
            await bad.WriteStringAsync("Content-Type must be application/json.");
            return bad;
        }

        // Safe body read
        using var reader = new StreamReader(req.Body);
        var body = await reader.ReadToEndAsync();
        ChatRequest? input;
        try
        {
            input = JsonSerializer.Deserialize<ChatRequest>(body, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
        }
        catch
        {
            var bad = req.CreateResponse(HttpStatusCode.BadRequest);
            await bad.WriteStringAsync("Invalid JSON.");
            return bad;
        }

        if (input is null || string.IsNullOrWhiteSpace(input.Prompt))
        {
            var bad = req.CreateResponse(HttpStatusCode.BadRequest);
            await bad.WriteStringAsync("Prompt is required.");
            return bad;
        }

        var loggerScope = new Dictionary<string, object> { ["UserObjectId"] = principal.FindFirst("http://schemas.microsoft.com/identity/claims/objectidentifier")?.Value ?? "unknown" };
        using (logger.BeginScope(loggerScope))
        {
            try
            {
                var result = await promptService.CreateChatResponseAsync(input.Prompt, context.CancellationToken);
                var ok = req.CreateResponse(HttpStatusCode.OK);
                await ok.WriteAsJsonAsync(new { response = result });
                return ok;
            }
            catch (Exception ex)
            {
                logger.LogError(ex, "Error generating chat response");
                var err = req.CreateResponse(HttpStatusCode.BadGateway);
                await err.WriteStringAsync("AI request failed. Try again later.");
                return err;
            }
        }
    }
}
// appsettings.json (for local debug)
{
  "OpenAI": {
    "Endpoint": "https://<your-aoai-name>.openai.azure.com/",
    "Deployment": "chat-gpt-4o-mini"
  }
}

Tip: When running locally, ensure you are logged in with Azure CLI (az login) so DefaultAzureCredential can acquire a token. Assign yourself Cognitive Services OpenAI User on the AOAI resource for testing.

3) Enforce Azure AD (Easy Auth) - configuration example

The Bicep above enables Easy Auth and returns 401 for unauthenticated calls. If you maintain settings as JSON, you can also use an ARM style configuration:

// Example snippet (appsettings for site config via ARM/Bicep-style) ensures:
// - requireAuthentication: true
// - allowedAudiences must match the audience used by your client (Power Apps custom connector)
{
  "properties": {
    "authSettingsV2": {
      "platform": { "enabled": true },
      "globalValidation": {
        "requireAuthentication": true,
        "unauthenticatedClientAction": "Return401"
      },
      "identityProviders": {
        "azureActiveDirectory": {
          "enabled": true,
          "validation": {
            "allowedAudiences": [ "api://<your-app-id>" ]
          }
        }
      }
    }
  }
}

Tip: For most enterprise setups, register a dedicated App Registration for the Function API and reference its Application ID URI in allowedAudiences. Keep consent and scopes explicit.

4) Create a Power Apps Custom Connector

  1. In Power Apps, open Solutions and create a new Custom Connector.
  2. Set the Host to your Function URL (e.g., https://<func-name>.azurewebsites.net).
  3. Define the POST /chat operation that accepts a JSON body { "prompt": "..." } and returns { "response": "..." }.
  4. Security: Choose OAuth 2.0 (Azure Active Directory). Set Audience to match allowedAudiences (api://<your-app-id>). Supply Tenant ID and Client ID as provided by your admin.
  5. Test the connector. You should receive HTTP 200 with the AI response. Unauthorized calls return 401.

5) Add client-side validation in Power Apps (Power Fx)

Before invoking the connector, validate inputs in the app to fail fast and reduce server load.

// Example Power Fx for a button's OnSelect
If(
    IsBlank(Trim(txtPrompt.Text)) || Len(Trim(txtPrompt.Text)) < 3,
    Notify("Please enter at least 3 characters.", NotificationType.Error),
    Set(
        aiResult,
        YourConnector.chat(
            {
                prompt: Trim(txtPrompt.Text)
            }
        ).response
    )
);

// Display result in a Label: Text = aiResult

Tip: Add input length limits and debouncing for multi-keystroke actions. For read-only UI against data, prefer server-side pagination and AsNoTracking() on the API layer where EF Core is involved.

Best Practices & Security

Identity and RBAC

  • Use Managed Identity for the Function App; never store secrets. The sample uses DefaultAzureCredential.
  • Assign the Cognitive Services OpenAI User role to the Function’s identity on the Azure OpenAI resource. This allows API calls without exposing keys.
  • Enforce Azure AD with Easy Auth at the platform level and verify identity in code for defense in depth.

Least Privilege and Network

  • Restrict access with the minimum RBAC scope necessary. Avoid granting Contributor on the subscription.
  • Enable HTTPS only and TLS 1.2+. Disable FTP/FTPS where possible.
  • Consider Private Endpoints for Azure OpenAI and Functions behind an Application Gateway/WAF for enterprise networks.

Validation, Error Handling, and Reliability

  • Validate input on both client (Power Apps) and server (Function). The code enforces content-type and schema shape.
  • Handle exceptions using middleware and return generic messages with correlation IDs to avoid leaking internals.
  • Implement circuit breakers and retries for downstream calls with transient fault policies if you add HTTP dependencies.

Observability

  • Use Application Insights. Log prompt sizes and latency, not raw sensitive content.
  • Sample KQL to investigate errors:
// Requests by operation
requests
| where url endswith "/chat"
| summarize count() by resultCode

// Exceptions with correlation
exceptions
| where operation_Name == "chat"
| project timestamp, type, problemId, outerMessage, operation_Id

// Latency p95
requests
| where url endswith "/chat"
| summarize p95(duration) by bin(timestamp, 1h)

Cost and Abuse Controls

  • Apply rate limiting at the API Management layer if exposing broadly.
  • Set MaxTokens and Temperature conservatively; monitor usage with budgets and alerts.
  • Implement content filters as needed using Azure AI Content Safety.

Summary

  • Power Apps integrates cleanly with AI by calling a secure .NET 8 Azure Function that uses Managed Identity to access Azure OpenAI.
  • Security is enforced with Azure AD (Easy Auth) and RBAC, specifically the Cognitive Services OpenAI User role.
  • IaC with Bicep, defensive coding, and Application Insights deliver repeatable, production-grade operations.

Saturday, 17 January 2026

AI in 2026: Key Expectations, Trends, and How to Prepare

Overview: Where AI Is Heading in 2026

The phrase expectations in Artificial Intelligence in 2026 captures a pivotal moment: AI is shifting from experimental pilots to production-grade systems that power everyday products, business workflows, and developer tooling. In 2026, expect faster multimodal models, trustworthy guardrails, on-device intelligence, and measurable ROI across industries.

Key Trends Shaping AI in 2026

1) Multimodal AI goes mainstream

Models that understand and generate text, images, audio, and structured data together will be standard in design, support, analytics, and accessibility. This unlocks richer search, smarter dashboards, and hands-free interfaces.

  • Impact: Better product discovery, visual troubleshooting, and voice-first experiences.
  • What to watch: Faster inference, higher fidelity outputs, and tool-augmented reasoning.

2) Agentic workflows and tool-use

“AI agents” will reliably plan, call tools/APIs, retrieve knowledge, and verify results. Guardrails will improve success rates for repetitive tasks like reporting, data entry, and QA.

  • Impact: Hours saved per employee per week; higher process quality.
  • What to watch: ReAct-style reasoning, structured output validation, and human-in-the-loop approvals.

3) On-device and edge AI

Smaller, efficient models will run on laptops, phones, and IoT, reducing latency and boosting privacy.

  • Impact: Offline assistance, instant transcription, and smarter sensors.
  • What to watch: Quantization, distillation, hardware accelerators, and hybrid cloud-edge orchestration.

Enterprise AI: From Pilots to ROI

4) Production-ready governance

Companies will standardize model evaluation, versioning, prompt/change management, and audit trails, reducing risk and downtime.

  • Impact: Faster approvals, repeatable deployments, and compliance confidence.
  • What to watch: Evaluation suites (quality, bias, drift), prompt registries, and policy-based routing.

5) Retrieval-augmented solutions

Retrieval-Augmented Generation (RAG) will remain a top pattern for reliable, up-to-date answers over private data.

  • Impact: Trustworthy chat over docs, catalogs, and tickets.
  • What to watch: Better chunking, embeddings, re-ranking, and citations.

6) Cost, latency, and quality optimization

Teams will mix foundation models with compact domain models, caching, and response routing to hit budget and SLA targets.

  • Impact: Lower TCO with equal or better outcomes.
  • What to watch: Adaptive model selection and response compression.

Trust, Safety, and Responsible AI

7) Policy-aware systems

Expect clearer controls for safety filters, data residency, privacy, and content provenance (watermarking/signals) to strengthen user trust.

  • Impact: Safer deployments across industries.
  • What to watch: Red-teaming, safety benchmarks, and provenance indicators.

8) Transparency and evaluation

Standardized reporting on model behavior, data handling, and risk will help buyers compare solutions and meet internal requirements.

  • Impact: Faster procurement and stakeholder alignment.
  • What to watch: Model cards, evaluation leaderboards, and continuous monitoring.

Practical Examples and Use Cases

Customer experience

  • Multimodal support: Users upload a product photo; the agent identifies the part, pulls the warranty, and guides a fix.
  • Proactive retention: Agents detect churn risk and trigger personalized offers.

Operations and analytics

  • Automated reporting: An agent compiles KPI decks, checks anomalies, and drafts executive summaries with citations.
  • Data quality: AI flags schema drift, missing values, and conflicting metrics.

Product and engineering

  • On-device coding assistant: Suggests patches offline, enforces style, and cites docs.
  • Design co-pilot: Generates UI variants from sketches with accessibility checks.

How to Prepare in 2026

  • Start with narrow, high-value tasks: Pick workflows with clear KPIs and guardrails.
  • Adopt RAG for accuracy: Keep answers grounded in your latest, approved content.
  • Instrument everything: Track cost, latency, win rate, user satisfaction, and error types.
  • Establish governance: Version prompts, document changes, audit access, and define escalation paths.
  • Optimize stack: Use a mix of large and small models, caching, and adaptive routing.
  • Invest in data: Clean, labeled, and searchable content boosts model performance.
  • Train teams: Upskill on prompt patterns, evaluation, and safe deployment practices.

Bottom Line

In 2026, the most successful AI programs will combine multimodal models, agentic tool-use, strong governance, and cost-aware engineering. By focusing on measurable outcomes and trustworthy systems, organizations can turn expectations in Artificial Intelligence in 2026 into durable competitive advantage.