PS > $spListItem["Date"] = Get-Date in Visual Studio .NET

Printing QR-Code in Visual Studio .NET PS > $spListItem["Date"] = Get-Date

PS > $spListItem["Date"] = Get-Date
QR Code Scanner In .NET
Using Barcode Control SDK for .NET Control to generate, create, read, scan barcode image in .NET framework applications.
QR Code Generation In .NET Framework
Using Barcode encoder for VS .NET Control to generate, create Quick Response Code image in Visual Studio .NET applications.
15:
Scanning Quick Response Code In .NET
Using Barcode decoder for .NET framework Control to read, scan read, scan image in .NET framework applications.
Barcode Generation In .NET Framework
Using Barcode encoder for .NET framework Control to generate, create bar code image in .NET framework applications.
Managing SharePoint List Items
Recognize Barcode In Visual Studio .NET
Using Barcode scanner for .NET Control to read, scan read, scan image in .NET applications.
Create QR-Code In Visual C#
Using Barcode printer for .NET Control to generate, create QR Code image in Visual Studio .NET applications.
The YesNo field accepts Boolean values This example shows how to supply a value of True as input
QR Drawer In Visual Studio .NET
Using Barcode creator for ASP.NET Control to generate, create Denso QR Bar Code image in ASP.NET applications.
QR Code JIS X 0510 Creation In Visual Basic .NET
Using Barcode encoder for Visual Studio .NET Control to generate, create QR image in Visual Studio .NET applications.
PS > $spListItem["YesNo"] = $true
Drawing EAN / UCC - 13 In .NET Framework
Using Barcode maker for .NET Control to generate, create GTIN - 128 image in .NET applications.
Making GS1 DataBar Expanded In .NET Framework
Using Barcode maker for Visual Studio .NET Control to generate, create GS1 DataBar Limited image in VS .NET applications.
The Lookup field type differs a little from the previous examples because fields of this type contain just a reference to a list item that exists in a different list In SharePoint 2007, the value added to a lookup field needed to start with the list item s ID followed by ";#", followed by the list item s title This also works in SharePoint 2010, as shown in the following example, in which we retrieve a list item from the Announcements list and create a string value that matches the lookup field format
Bar Code Maker In .NET
Using Barcode creator for VS .NET Control to generate, create bar code image in .NET applications.
Print EAN8 In Visual Studio .NET
Using Barcode creation for .NET framework Control to generate, create GTIN - 8 image in Visual Studio .NET applications.
PS >> PS PS >> > $spAnnouncementsList = Get-SPList -url "http://nimaintranet/Lists/Announcements" > $spLookupListItem = $spAnnouncementsListGetItemById(1) > $strLookupListItem = [string]$spLookupListItemID + ";#" + $spLookupListItemTitle
EAN128 Reader In Visual C#
Using Barcode scanner for .NET Control to read, scan read, scan image in VS .NET applications.
Encoding Code 39 Extended In None
Using Barcode encoder for Microsoft Excel Control to generate, create USS Code 39 image in Excel applications.
Here, we store the reference to the Announcements list in a variable and use the
Painting Bar Code In Java
Using Barcode drawer for BIRT reports Control to generate, create barcode image in BIRT applications.
Code 39 Full ASCII Drawer In VB.NET
Using Barcode generator for .NET Control to generate, create Code 3 of 9 image in .NET framework applications.
GetItemById method to retrieve a list item We then use the ID and Title properties of the SPListItem object to create a string that we can use as value for a lookup field We also explicitly cast the ID as a SystemString object; otherwise, Windows PowerShell will attempt to interpret all the values as SystemInt32, and an error will
Painting EAN 13 In Java
Using Barcode encoder for Java Control to generate, create EAN-13 Supplement 5 image in Java applications.
Decode Code 128 Code Set B In C#
Using Barcode recognizer for VS .NET Control to read, scan read, scan image in .NET framework applications.
occur Here is the resulting string value:
Recognizing USS Code 128 In None
Using Barcode scanner for Software Control to read, scan read, scan image in Software applications.
Bar Code Maker In VB.NET
Using Barcode encoder for VS .NET Control to generate, create barcode image in VS .NET applications.
PS > $strLookupListItem 1;#Get Started with Microsoft SharePoint Foundation!
We can then use our variable as the value for the lookup field
PS > $spListItem["Lookup"] = $strLookupListItem
In SharePoint 2010, you can also use a list item object as value to a lookup field directly, instead of creating a string in a specific format
PS > $spListItem["Lookup"] = >> (Get-SPList "http://nimaintranet/Lists/Announcements") GetItemById(1)
Person or group type fields are similar to lookup fields in that they support values that follow the ID;#Title format, where Title is the display name of the user or group to add In fact, these fields are lookup fields that, behind the scenes, reference the hidden User Info list in each site collection
PowerShell for Microsoft SharePoint 2010 Administrators
In SharePoint 2010, you can use the Get-SPUser cmdlet to return a user account from a SharePoint site Just as with lookup fields, you can either create a string value that follows the ID;#Title format or use an SPUser object as input The following example shows how to retrieve the account of user Kenny Bania and use it as the value for the field
PS > $spUser = Get-SPUser -Web http://nimaintranet ` >> -Identity POWERSHELL\kennybania PS > $spListItem["Person or Group"] = $spUser
The last field in our example is a hyperlink or picture field The valid format of a value for a field of this type is an address, followed by a comma, followed by a description, as shown here:
PS > $spListItem["Hyperlink"] = >> "http://wwwpowershellnu, Windows PowerShell blog"
When we have assigned values to all the fields of our new item, we call the Update method to commit the changes to the SharePoint 2010 content database
PS > $spListItemUpdate()
The following is the New-SPListItem function, which creates new list items in a SharePoint 2010 list The function uses the Get-SPList function described in 14
function New-SPListItem ([string]$url) { # Use the Get-SPList function to retrieve a list $spList = Get-SPList -url $url return $spListAddItem(); }
And here is an example of this function in action:
PS > $spListItem = New-SPListItem -url "http://nimaintranet/Lists/Custom List" PS > $spListItem["Title"] = "My List Item" PS > $spListItemUpdate()
Figure 15-2 shows the new item added to the list
15:
Managing SharePoint List Items
Figure 15-2
List item created using Windows PowerShell
Updating List Items
The SPList class provides a few methods we can use to retrieve an item from a list in SharePoint 2010 The following methods are the most commonly used:
GetItemById, which requires that we know the ID of the particular item GetItems, which is used to return all list items or a subset of list items as
defined by search criteria in a CAML query First, let s take a look at the GetItemById method The method takes the ID of a list item as input and returns a SPListItem object This example shows how to retrieve the list item with the ID of 1 from a list and store it in a variable
PS > $spList = Get-SPList -url "http://nimaintranet/Lists/Custom List" PS > $spListItem = $spListGetItemById(1)
Copyright © OnBarcode.com . All rights reserved.