Comments (6)
Change "Title "to "Name" getr same result
from pnp-powershell.
The reason you get that output is because of the way PowerShell works. What you see is a collection of list items. PowerShell has no knowledge whatsoever of which fields are being included in the listitem. It renders (through the means of a definition that is located in a static file, OfficeDevPnP.PowerShell.Commands.Format.ps1xml, that is located in the installation folder of the cmdlets), a few of the object properties (so not fields) that are always there for a listitem, regardless if they have a value or not.
In your case you will have to do some additional powershell scripting:
Get-SPOListItem -List "Style Library" -Fields "FileLeafRef", "Modified" | %{new-object psobject -property @{Id = $_.Id; Name = $_["FileLeafRef"]; Modified = $_["Modified"]}} | select Id, Name, Modified
This basically tells the cmdlet to retrieve the list items in the Style Library, and only load the FileLeafRef and Modified field values for those items, that's the whole reason behind the Fields parameter, not to define what it outputs, but to define what it retrieves, to offload the server and to keep the data going over the wire as small as possible.
Regarding the Name/Title field: what SharePoint renders as a 'Name' in the UI for a document library is actually stored in the "FileLeafRef" field. If you want to see the full path, use "FileRef" instead.
The second part of the example above tells PowerShell to create a new object, and set 3 properties, Id, Name and Modified to it's appropriate values, where $_ refers to the current listitem object.
The 3rd part the example above, the select cmdlet, makes sure that the properties are rendered in the order you want them to be rendered in.
I will close this issue now.
from pnp-powershell.
Thanks Erwin - should this not be in the get-help -detailed help text ?
from pnp-powershell.
As such it's standard behaviour of any powershell cmdlet to return objects, there is no specific case around the get-spolistitem cmdlet as such in my opinion. But be my guest and add it? It doesn't hurt to have it there.
from pnp-powershell.
Do I need Visual Studio to do it ?
From: Erwin van Hunen [mailto:[email protected]]
Sent: Friday, September 25, 2015 3:58 PM
To: OfficeDev/PnP-PowerShell [email protected]
Cc: Nigel Price [email protected]
Subject: Re: [PnP-PowerShell] Get-SPOListItem with -Fields "Title",Modified" does not dispay correct results (#76)
As such it's standard behaviour of any powershell cmdlet to return objects, there is no specific case around the get-spolistitem cmdlet as such in my opinion. But be my guest and add it? It doesn't hurt to have it there.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/76#issuecomment-143245187.
No virus found in this message.
Checked by AVG - www.avg.comhttp://www.avg.com
Version: 2015.0.6125 / Virus Database: 4419/10693 - Release Date: 09/24/15
from pnp-powershell.
yes, it requires visual studio, and a correctly set up git fork and repository
from pnp-powershell.
Related Issues (20)
- [BUG] Set-PnPGroup -SetAssociatedGroup Owners: Access denied.
- Example 1 incorrect on Clear-PnPRecycleBinItem Microsoft Docs page HOT 1
- Get-PnPTerm unable to retrieve labels HOT 2
- [BUG]
- [BUG] Term Store PnP functions fail when using Connect-PnPOnline -SPOManagementShell HOT 7
- [BUG]? - Grant-PnPTenantServicePrincipalPermission timing out HOT 2
- [BUG] false error reported from Add-PnPFolder on large Library
- Connect-PnPOnline- with an option of -ClientId and -ClientSecreat connects successfully but then get unauthorized(401)) for subsequent request example Get-PNPList etc.
- Critical problem with Apply-PnPProvisioningTemplate cmdlet: personal view is created as public view in the destination site
- [BUG] - Move-PnPFolder : The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.
- [BUG] Get-PnPSite -Includes Usage Shows Zero for Bandwidth, Hits, Visits
- [BUG] "The user cannot create group sites in this tenant instance." HOT 3
- [BUG] ConvertTo-PnPClientSidePage fails at OfficeDevPnP.Core.Pages.ClientSidePage.AvailableClientSideComponents(String name) - A critical error occurred - transformation did not complete
- [BUG] Get-PnPTerm throws misleading error if term not found
- [BUG] Add-PnPWebhookSubscription. Body empty.
- [BUG]
- Get-PnPFolder : A parameter cannot be found that matches parameter name 'List'[BUG]
- [BUG] Search bar for List gets enabled while trying to hide suitebar search using "Set-PnPSearchSettings -SearchBoxInNavBar Hidden -Scope Web". Is there any way to hide search bar for list too.
- [BUG] GCC High client tokens Confidential Client is not supported in Cross Cloud request
- Set-PnPSite command reporting (401) Unauthorized Error, in environment where legacy authentication is blocked HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pnp-powershell.