This blog will show you how to programmatically deploy SharePoint Premium Autofill columns in SharePoint document libraries. I will also show how to programmatically process existing documents with Autofill rules. This developer focused blog will provide the necessary PowerShell commands to create/manipulate the JSON required for the list properties where Autofill config settings are stored.
Previous Blog: Game Changer: Autofill columns Now Available in SharePoint Premium – Leon Armston’s Blog

I’m thrilled about Autofill columns and consider it SharePoint’s best work to date! While exploring the backend, I found that the settings for Autofill columns for each list are stored collectively in the “list” property bag field Vti_SyntexPoweredColumnPrompts, rather than within the individual field properties. This discovery was a bit surprising and, to be honest, somewhat disappointing. I hope that in the future, Autofill column configurations can be housed within the field properties. This change would enable them to be reused as site columns and distributed through the Content Type hub across the tenant. Centralized updates would then be possible, simplifying the management of prompt changes without the need to manually update each list.



$libraryName = “Autofill” #Enter the library url here
Get-PnPPropertyBag -Key “Vti_SyntexPoweredColumnPrompts” -Folder $libraryName
Through the UI all calls to get the Autofill config is through the SPO REST API so my scripts below will focus on this approach.
NOTE : The Autofill part of the Microsoft Syntex REST API is not documented yet! So is subject to change.
However you could use the PowerShell Set-PnPPropertyBagValue to also update the Autofill column config for a list if you know the format of the JSON.
I will now demonstrate how you can programmatically add and edit existing Autofill columns using PowerShell, as well as request a file to be reprocessed. You can then incorporate these steps into your provisioning solutions or scripts to bulk add and manage Autofill columns.
Script Required
Activate or edit existing Autofill Column
The process through the UI for Autofill is explained in my previous blog on Autofill. It is simply: add a column (Text, Multiple lines of text, Number, Yes/No, Date and time, Choice, Hyperlink, Currency). Then, go into the column properties, activate Autofill, and create/test a prompt before saving the settings.

First create a field in your library using the PnP PowerShell command Add-PnPField or even through the UI – take a note of the field name.
Below is a script which is uses PnP PowerShell to add and edit existing Autofill columns. Change lines 1 to 5 to reflect the details of your environment.
This script connects to the specified site or list, retrieves information about the desired field, and fetches the Autofill configuration (JSON) using a GET request to the SPO REST API endpoint <your site url>/_api/machinelearning/getSyntexPoweredColumnPrompts(‘%7B<Your library ID>%7D’)
The script creates or edits the retrieved JSON for the SyntexPoweredColumnPrompts list property. The script can activate a column for Autofill, modify an existing Autofill column (e.g., changing the prompt), or disable it from being used with Autofill. It handles all necessary JSON manipulations before submitting the changes.
The script creates a JSON payload like below and sends it as a POST request to: the API endpoint <your site url>/_api/machinelearning/SetSyntexPoweredColumnPrompts to update the list property with the updated Autofill config.
1 2 3 4 | { "docLibId": "{e042afcd-15d9-4790-a125-264e3b80cdaf}", "syntexPoweredColumnPrompts": "[{\"columnId\":\"cb8daf1e-f405-4e1a-96ed-4720ca0dd217\",\"isEnabled\":true,\"columnName\":\"DocumentTitle\",\"prompt\":\"Identifyyyy the Document Title from this document and add here. Add five exclamation marks at the end of the string\"},{\"columnId\":\"150d9d35-7af0-4d70-85c4-22c8579e129e\",\"isEnabled\":true,\"columnName\":\"_x0031_0WordSummary\",\"prompt\":\"Generate a summary of this document in 10 words\"},{\"columnId\":\"e53785cb-30ef-49ad-a0d3-68b855e1b868\",\"isEnabled\":true,\"columnName\":\"RecommendedXmasSong\",\"prompt\":\"Summarise this document, then based on the sentiment of the summary suggest a Christmas song to accompany it and an explanation as to why? Do not include the summary in the output..\"},{\"columnId\":\"d7027683-69b2-4bc6-8c5a-43e41c6dd991\",\"isEnabled\":true,\"columnName\":\"Airline\",\"prompt\":\"Identify the airlines listed in the document based on the following choices: American Airlines, British Airways, easyJet, Kalitta Air, Red Wings, SAS Scandinavian Airlines, SATA International, Serene Air, Sky Gates Airlines, UIA Ukraine International, Western Global Airlines. Reply with one or more of the choices only. Reply with a blank value if none of the choices fit.\"},{\"columnId\":\"b41a23c6-a6c0-46db-a8ba-97b47e8d48ed\",\"isEnabled\":true,\"columnName\":\"DocumentType\",\"prompt\":\"What type of document is this? Provide a high level agnostic document type. Capitalise alternate letters in the returned output. If no proper answer is found, respond with \\\"not founder\\\".\"},{\"columnId\":\"187f0f10-00d2-4a74-8439-f3cec3a36984\",\"isEnabled\":true,\"columnName\":\"PirateSummary\",\"prompt\":\"Summarise this document as a Pirate but replace all references to planes with pirate ships and replace all aircraft/airport words with the equivalent seafaring words\"},{\"columnId\":\"7b9bd289-5bdf-4afe-b621-6bd9a5a5f34e\",\"isEnabled\":true,\"columnName\":\"ExplainlikeImfive\",\"prompt\":\"Summarise this document and explain tome like I'm five years of age\"},{\"columnId\":\"08872e01-6b43-4430-9232-3fb587e31273\",\"isEnabled\":true,\"columnName\":\"WordCount\",\"prompt\":\"Count the number of words\"},{\"columnId\":\"f978dab5-a6e8-40fc-b776-cc1c92e08172\",\"isEnabled\":true,\"columnName\":\"SourceLanguage\",\"prompt\":\"Read document and identify spoken language - return in ISO 639-3 code\"},{\"columnId\":\"911d53e6-709e-4faf-8895-ba1282535d66\",\"isEnabled\":true,\"columnName\":\"Compensationperpassenger\",\"prompt\":\"You have a million pounds to give as compensation split it equally between all passengers. Return the number of passengers and the calculations per passenger. Then give equivalent amounts in USD, NZD & EUR in bullet points\"},{\"columnId\":\"996aed65-5730-47a8-8d2d-c4d84688feca\",\"isEnabled\":true,\"columnName\":\"ZTest\",\"prompt\":\"Give me a summary using 25 words\"}]" } |
Once the script completes you will get the following back from the API to confirm your changes have been applied.

You can now visit the Column properties in the UI for the column you just activated or edited for Autofill to view the applied changes. If you need to do this for multiple columns, you will have to run the script multiple times, editing the script variables for each required Autofill column each time.
You could also update the Autofill column configuration for a list using PnP PowerShell. Simply use the command:
Set-PnPPropertyBagValue -Key “Vti_SyntexPoweredColumnPrompts” -Folder “Your Library Url i.e. Autofill” -Value “Autofill columns JSON config here”
This method works if you know the format of the JSON and is just the syntexPoweredColumnPrompts part – no docLibId is required. See below for an example:

Request a file is re-processed with Autofill rules
When you add a new Autofill column or modify an existing one (e.g., change a prompt), the existing files in the library are not automatically processed. To re-process these files, you need to select them in the document library and then choose the Autofill option from the document library toolbar (see image below).

I however wanted to see if this could be automated and can see it is done through SPO REST API so I created a script to do this.
Change lines 1 to 3 to reflect the URL of your sites, the library name & the ID of the file to be processed.
The script generates obtains your site ID, web ID and the document unique ID then creates a JSON payload like below and sends it as a POST request to: the API endpoint <your site url>/_api/machinelearning/workItems
1 2 3 4 5 6 7 8 9 10 11 | { "__metadata": { "type": "Microsoft.Office.Server.ContentCenter.SPMachineLearningWorkItemEntityData" }, "IsFolder": false, "ProfileName": "AutofillColumnsWriteback", "TargetSiteId": "18dfc66a-2fa5-4b83-adf5-8726b62a6861", "TargetWebId": "b0224f93-49be-4957-8e22-edbb489c937e", "TargetUniqueId": "0a8dd21d-ca95-4693-92ac-967c0614aac1", "Type": "AE9D4F24-EE84-4C0C-A972-A74CFFE939A1" } |
Once the script has completed you will recieve a retuned message like below with details of the file indicating it has been queued for processing for Autofill.

Summary
SharePoint Premium Autofill columns is awesome and I cannot wait to see more people becoming aware of it’s power and using it with their files.
I wanted to explore how the Autofill settings are configured behind the scenes, as I see significant benefits in incorporating this into provisioning solutions to programmatically add Autofill columns to libraries.
Some provisioning/prompt suggestions:
- Add a 10 word summary column to every project document library to summarise all documents.
- Add a Autofill column to every document library to extract project codes.
- See my other Autofill blog for suggested prompts
I hope the Autofill column configuration will soon be integrated into the field properties, which I’m confident will happen in due time! This change would allow Autofill columns to be reused as site columns and enable centralized updates. Although the current setup, with all Autofill settings in the list property bag, is less than ideal, it is manageable using the patterns and APIs demonstrated in the scripts above. However, for Autofill to advance to the next level, these properties need to be stored within the field itself.
See my other blogs for other methods/scripts to administrate other SharePoint Premium functionality through PowerShell/Power Automate. Add these to your Provisioning Solutions or code today!
- The Ultimate Guide to Adding SharePoint Premium Taxonomy Tagging Columns Programmatically.
- Activate SharePoint Premium Image Tagging with PowerShell
- Automate SharePoint Premium Document Translation
Let me know if this blog is helpful and you are starting to deploy SharePoint Premium Autofill columns programmatically or whether you have any questions or feedback. Happy to help!
great post thanks Leon.
Hi Leon,
I want to share my testing for deploy autofill columns with powershell.
First this is a great article which explore the black box. But it seems many things have been changed.
I tested on my syntex site which has enabled the autofill column on document library.
I found that
1. I cannot find the related property bag (“Vti_SyntexPoweredColumnPrompts”) on my document library.
2. I got empty result when I call “/_api/machinelearning/getSyntexPoweredColumnPrompts” api ( So I don’t try /_api/machinelearning/SetSyntexPoweredColumnPrompts )
3. I can find the autofill property in pnp template file when I use PnP Powershell (Export-PnPListToSiteTemplate) to export the list as template
4. If you just deploy this list template to a site which never enable autofill feature before, you will get an error saying the site column doesn’t exist because autofill requires 4~5 site columns. So I need first manually create an autofill column prompt on this site to trigger the site column, then I can run “Invoke-PnPSiteTemplate”
5. It will deploy the autofill in the columns but you still cannot see “autofill” command for your items. You have to manually save the prompt text (this step may trigger something), then you can see the “autofill” command in the command bar.
Here is my experience to deploy autofill document library to another site
Hi Tony
Thanks for reading my blog and thanks for bringing this to my attention! It looks like the backend APIs have changed! Will edeavour to have a look and try and fix this page/script!
Thanks
Leon