Infopath Forms Library Field Update in SP2019 using PowerShell

Bikram Pal 80 Reputation points
2024-01-04T21:04:12.8066667+00:00

Hi There, I have a Infopath form library and have create a field in the infopath form and have promoted it to the sharepoint form library. I want to update the data in the field for item id 1911, i am able to retreive the value of the field in the powershell but i am not able to update it. is there a powershell code to update the value of the single line of text field?

Microsoft 365 and Office | SharePoint Server | For business
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

Accepted answer
  1. AllenXu-MSFT 24,956 Reputation points Moderator
    2024-01-05T02:50:30.5833333+00:00

    Hi @Bikram Pal,

    You can update the text field of an item by item ID using PowerShell like the example below.

    $SiteURL = "http://sp2019"
    $ListName = "test"
     
    #Get the List
    $List = (Get-SPWeb $SiteURL).Lists.TryGetList($ListName)
     
    #List of Item IDs to update
    $ItemID = 1911
    
    #Get Item by ID
    $ListItem = $List.GetItembyID($ItemID)
     
    #Update List Item Fields 
    $ListItem["TextField"]="test"
    
    $ListItem.SystemUpdate()
    Write-host "Updated Item ID:"$ItemID
    

    Remember to replace the variable $SiteURL, $ListName, $ListItem["ColumnName"] with your own.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.