Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Powershell script needed to update a field in Sharepoint list

Posted on 2010-11-11
1
Medium Priority
?
833 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 2000 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

In case you ever have to remove a faulty web part from a page , add the following to the end of the page url ?contents=1
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

670 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