Solved

Powershell script needed to update a field in Sharepoint list

Posted on 2010-11-11
1
829 Views
Last Modified: 2012-05-10
I have a Powershell script that prompts for a project number, then performs a series of file and directory operations, but after it completes those operations I need it to locate an item in my Sharepoint "ProjectBid" list by "ProjectNum", then change the "Status" field to "Submitted"

Does anyone have a sample script that performs something like that?

Thank You,

Jim
0
Comment
Question by:jjeffcoat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 16

Accepted Solution

by:
quihong earned 500 total points
ID: 34113497
You're in luck.

Try something like the below. Double check the if syntax. There's probably better ways to pull out the exact listitem you want using a camel query but the below is simpler to understand and do.
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null
$SPSite = New-Object Microsoft.SharePoint.SPSite("http://server/sites/sitename")
$SPWeb = $SPSite.OpenWeb()
$SPList = $SPWeb.Lists["ProjectBid"]
foreach ($listItem in $SPList.Items)
{

    if ($listItem["ProjectNum"] -eq $yourProjectNumber)
    {
       $listItem["Status"] = "Submitted"
       $listItem.Update()
    }
}


$SPWeb.Dispose()
$SPSite.Dispose()

Open in new window

0

Featured Post

IoT Devices - Fast, Cheap or Secure…Pick Two

The IoT market is growing at a rapid pace and manufacturers are under pressure to quickly provide new products. Can you be sure that your devices do what they're supposed to do, while still being secure?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question