locked
Unable to update a Column value in a sharepoint list RRS feed

  • Question

  • I have a Sharepoint List in which documents are uploaded and this list has several columns. Some of these columns are automatically populated from a Form(document) filled by user. Other columns are updated using a Workflow. These include a URL & the status of the form.

    Now I am trying to automate the task and bypass the workflow part and manully fill these columns using powershell.

    I am able to update the value of URL field. But if I try to update the Status field I get the following error-

    Unable to index into an Object of type Microsoft.SharePoint.SPListItem

    The Code I am trying to use is

    $Web = Get-SPweb "Sharepoint site name"

    $List = $Web.Lists["Request"]  ############ Request is the name of List

    $SPItem = $List.GetItembyId($Id) ########## $Id is the # of document in sequence

    $SpItem["URL"] = $URl ########### this URL is calculated in another part of the Code.

    $SpItem["Status"] = "Completed"

    $SpItem.Update()

    After running this code the value of URL field is updated successfully but status field gives an error.

    Please let me know if i am doing something wrong.

    • Moved by Just Karl Monday, June 2, 2014 3:31 PM Looking for the proper forum.
    Friday, October 4, 2013 4:38 PM

Answers

  • Hello,

    For those still looking, you should ask on the SharePoint forums.

    Karl


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C40686F746D61696C2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

    • Proposed as answer by Just Karl Tuesday, May 20, 2014 5:25 PM
    • Marked as answer by Just Karl Friday, June 13, 2014 8:45 PM
    Tuesday, May 20, 2014 5:18 PM