Forum Discussion
PowerShell examples - Get-SPOList and Get-SPOListItems
Thanks, i just trying to read some values from a list so that I can use them to create some new site collections. The fields are getting returned without any values,
I tried the example from the above document, and I get the following
Supply values for the following parameters:
Title :
Description :
BaseTemplate ID :
Created Date :
List ID :
ImageUrl :
ItemCount :
OnQuickLaunch :
Other spo cmdlets seem to be working fine. I can't figure out what would be causing me to get no values.
I figure out that i need to include \Lists\ in the listname parameter.
Now I just need to figure out how to get the value out of a column that returns Microsoft.SharePoint.Client.FieldUrlValue
I relearned that this can be done by using the following syntax
$listItem["SPOUrl"].Url
Dean_Gross wrote:Thanks, i just trying to read some values from a list so that I can use them to create some new site collections. The fields are getting returned without any values,
I tried the example from the above document, and I get the following
Supply values for the following parameters:
Title :
Description :
BaseTemplate ID :
Created Date :
List ID :
ImageUrl :
ItemCount :
OnQuickLaunch :
Other spo cmdlets seem to be working fine. I can't figure out what would be causing me to get no values.
I figure out that i need to include \Lists\ in the listname parameter.
Now I just need to figure out how to get the value out of a column that returns Microsoft.SharePoint.Client.FieldUrlValue
I relearned that this can be done by using the following syntax
$listItem["SPOUrl"].Url
Hi I have the same issue with the Author "Created By"column as this Client.FieldUserValue . I thought I could use but it doesn't quite work :smileymad:
Get-SPOListItem $listName -Fields "FileLeafRef", "Modified", "Author" | %{new-object psobject -property @{Id = $_.Id; Name = $_["FileLeafRef"]; Modified = $_["Modified"]; Author = $_["Author"] }} | select Id, Name, Modified, Author
I can see you have used another approach and probably get-spoContext
- Nov 17, 2016
Hi Daniel Westerdale, Dean_Gross
Sorry I missed something in my previous example.
this is the correct code:
$web = Get-SPOWeb
$lists = Get-SPOList -web $web
$list = $lists |where {$_.Title -eq "Sales list"}
$items = Get-SPOListItem -web $web -List $list
$items[1].FieldValues- Daniel WesterdaleNov 17, 2016Iron Contributor
Thanks, I might end up using that. I did something similar a while back but I thought I need to do
SPOExecute as we do for standard CSOM to populate our client side objects.
Anyway I digress, I intended to bring back some standard field for each list item with one line of PS code using a pipeline but it doesn't look like it
- Nov 17, 2016
The one line option :smileyhappy: :
(Get-SPOListItem -web (Get-SPOWeb) -List ((Get-SPOList -web (Get-SPOWeb))|where {$_.Title -eq "Sales list"}))[1].FieldValues