HomeAboutAll Posts

Applying SharePoint AI Autofill Prompts Programmatically

By Denis Molodtsov
Published in SharePoint
April 13, 2026
2 min read
Applying SharePoint AI Autofill Prompts Programmatically

Table Of Contents

01
The problem
02
TL;DR - apply an autofill prompt to a single field
03
Quick primer on autofill columns
04
Dead end 1: the old list property bag
05
Dead end 2: the AutofillInfo field property via REST
06
The discovery
07
The approach that worked
08
References

The problem

I had to roll out the same SharePoint “AI in SharePoint” autofill column prompts across 20 sites, each with up to 9 fields carrying AI prompts - roughly 170 prompts that needed to land on freshly deployed document libraries. Clicking through the UI was not an option.

Column with an Autofill prompt
Column with an Autofill prompt

The source libraries already had the prompts configured by a human who had lovingly written each one. My job was to lift them from the old MAIN DOC LIBRARY on each site and drop them onto the new DOC LIBRARY.

Copy prompts from one library to another
Copy prompts from one library to another

This post is the honest version of how that went, including the two dead ends before the approach that actually worked.

TL;DR - apply an autofill prompt to a single field

If you just want to attach an AI prompt to one column on one library, use the read-modify-write approach on the field’s SchemaXml via PnP.PowerShell CSOM:

powershell
Connect-PnPOnline -Url "https://contoso.sharepoint.com/sites/Knowledge" -UseWebLogin # < I'm using PowerShell.PnP 1.12 that supports the UseWebLogin flag
$field = Get-PnPField -List "Documents" -Identity "DocumentSummary"
$prompt = "Analyze the content and provide a brief 2-3 sentence overview."
$autofillInfo = @{
LLM = @{
IsEnabled = $true
Prompt = $prompt
CustomModelId = $null
CustomParametersJson = $null
AnalyzeImageWithVision = $false
AnalyzeImageDetailLevel = $null
AutofillColumnType = "Unknown"
}
PrebuiltModel = $null
} | ConvertTo-Json -Compress -Depth 10
[xml]$xmlDoc = $field.SchemaXml
$xmlDoc.DocumentElement.SetAttribute("AutofillInfo", $autofillInfo)
$field.SchemaXml = $xmlDoc.DocumentElement.OuterXml
$field.Update()
Invoke-PnPQuery

Newly uploaded files will be processed automatically; existing files need to be selected and run through the UI’s Autofill command once.

Quick primer on autofill columns

SharePoint Premium / “AI in SharePoint” lets you attach a natural-language prompt to a column. When a file is uploaded, GPT-4 Turbo reads the file and writes an answer to that column. You can see the feature in the UI as a small AI sparkle icon next to column names. Microsoft’s docs call it Autofill Columns.

The interesting question for automation is: where are those prompts actually stored? That turns out to be a moving target.

Dead end 1: the old list property bag

The first approach I found in community posts (Leon Armston wrote about this in mid-2024) said prompts were stored in a list-level property bag key called Vti_SyntexPoweredColumnPrompts. One JSON blob per list, holding every column’s prompt.

I used the PowerShell script that read it the obvious way:

powershell
$list = Get-PnPList -Identity "MAIN DOC LIBRARY"
Get-PnPProperty -ClientObject $list -Property RootFolder | Out-Null
Get-PnPProperty -ClientObject $list.RootFolder -Property Properties | Out-Null
$legacyJson = $list.RootFolder.Properties.FieldValues["Vti_SyntexPoweredColumnPrompts"]

Ran it against all 20 sites. Found zero prompts on any of them. But the sparkle icons were right there in the browser. So the storage location had clearly changed.

sparkle icon
sparkle icon

Dead end 2: the AutofillInfo field property via REST

Digging further, I found that in late 2025 Microsoft moved the configuration from the list property bag to a per-field property called AutofillInfo. The undocumented REST endpoint for writing is /_api/machinelearning/SetColumnLLMInfo.

Reading worked fine - GET /_api/web/lists(guid'X')/fields returns each field’s AutofillInfo as a top-level property. I re-ran the export, found about 170 real prompts spread across the 20 sites, and confirmed the JSON schema:

json
{
"LLM": {
"IsEnabled": true,
"Prompt": "Review the document and provide a two sentence summary...",
"CustomModelId": null,
"CustomParametersJson": null,
"AnalyzeImageWithVision": false,
"AnalyzeImageDetailLevel": null,
"AutofillColumnType": "Unknown"
},
"PrebuiltModel": null
}

Writing was the problem. I tried every reasonable shape: MERGE against the field entity with and without __metadata, PATCH, POST to SetColumnLLMInfo in both camelCase and PascalCase, wrapped in {request: {...}}, lowercase URL variant, Set-PnPField -Values. Nine strategies. The test script wrote each attempt to a log with a readback verification step so I could not be fooled by a silent “success.”

Every REST attempt failed with the same error:

A possible object cycle was detected which is not supported. This can either be due to a cycle or if the object depth is larger than the maximum allowed depth of 0.

Set-PnPField gave me a more informative failure:

WARNING: No property ‘AutofillInfo’ found on this field. Value will be ignored.

The CSOM SDK simply does not expose AutofillInfo as a first-class property.

The discovery

While staring at the diagnostic dump, I noticed the source field’s SchemaXml contained everything I needed:

xml
<Field Type="Note" Name="SummaryofDocument" DisplayName="Summary of Document"
ID="{82bb10b1-...}" StaticName="SummaryofDocument" AutofillInfo="{&quot;LLM&quot;:{&quot;IsEnabled&quot;:true, &quot;Prompt&quot;:&quot;Review the document... &quot;,
...}}" ... />

The AutofillInfo is an XML attribute on the <Field> element. And SchemaXml is a documented, writable CSOM property. Every SharePoint field has one. You can read it, modify it, and write it back.

The approach that worked

The core operation is maybe ten lines of PowerShell:

powershell
# Load source and target fields via CSOM
$srcField = Get-PnPField -List "MAIN DOC LIBRARY" -Identity "SummaryofDocument"
$tgtField = Get-PnPField -List "DOC LIBRARY" -Identity "SummaryOfDocument"
# Extract AutofillInfo attribute out of the source SchemaXml
if ($srcField.SchemaXml -match 'AutofillInfo="([^"]*)"') {
$autofillJson = [System.Web.HttpUtility]::HtmlDecode($Matches[1])
}
# Inject it into the target field's SchemaXml and persist via CSOM
[xml]$xmlDoc = $tgtField.SchemaXml
$xmlDoc.DocumentElement.SetAttribute("AutofillInfo", $autofillJson)
$tgtField.SchemaXml = $xmlDoc.DocumentElement.OuterXml
$tgtField.Update()
Invoke-PnPQuery

To scale it across 20 sites, I wrapped this in the same iteration pattern already used by the other deployment scripts in the project:

powershell
$Sites = Import-Excel -Path "All Sites.xlsx" |
Where-Object { $_.Type -eq "M365 Group" -and $_.Tag -ne "Skip" }
for ($i = 0; $i -lt $Sites.Count; $i++) {
$url = $Sites[$i].URL
Write-Host "[$($i + 1)/$($Sites.Count)] $url" -ForegroundColor Cyan
Connect-PnPOnline -Url $url -UseWebLogin
foreach ($src in Get-PnPField -List "MAIN DOC LIBRARY") {
if ($src.SchemaXml -notmatch 'AutofillInfo="([^"]*)"') { continue }
$autofillJson = [System.Web.HttpUtility]::HtmlDecode($Matches[1])
$targetName = if ($FieldRenames.ContainsKey($src.InternalName)) {
$FieldRenames[$src.InternalName]
} else {
$src.InternalName
}
$tgt = Get-PnPField -List "DOC LIBRARY" -Identity $targetName -ErrorAction SilentlyContinue
if (-not $tgt) { continue }
[xml]$xmlDoc = $tgt.SchemaXml
$xmlDoc.DocumentElement.SetAttribute("AutofillInfo", $autofillJson)
$tgt.SchemaXml = $xmlDoc.DocumentElement.OuterXml
$tgt.Update()
Invoke-PnPQuery
}
}

References


Tags

SharePointSharePoint OnlineAI in SharePointSyntexPnP PowerShellCSOMREST API

Share

Previous Article
Migrating File Shares to SharePoint - Operational Risks and Application Incompatibilities
Denis Molodtsov

Denis Molodtsov

Microsoft 365 Architect

Related Posts

Deep Dive into SharePoint Site Attestation - What the Docs Don't Tell You
Deep Dive into SharePoint Site Attestation - What the Docs Don't Tell You
April 01, 2026
7 min

Quick Links

AboutAll Posts

Social Media