Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pnp/sp

Package Overview
Dependencies
Maintainers
7
Versions
1072
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pnp/sp - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

40

docs/fields.md

@@ -53,2 +53,42 @@ # @pnp/sp/fields

## Filtering Fields
Sometimes you only want a subset of fields from the collection. Below are some examples of using the filter operator with the fields collection.
```TypeScript
import { sp } from '@pnp/sp';
const list = sp.web.lists.getByTitle('Custom');
// Fields which can be updated
const filter1 = `Hidden eq false and ReadOnlyField eq false`;
list.fields.select('InternalName').filter(filter1).get().then(fields => {
console.log(`Can be updated: ${fields.map(f => f.InternalName).join(', ')}`);
// Title, ...Custom, ContentType, Attachments
});
// Only custom field
const filter2 = `Hidden eq false and CanBeDeleted eq true`;
list.fields.select('InternalName').filter(filter2).get().then(fields => {
console.log(`Custom fields: ${fields.map(f => f.InternalName).join(', ')}`);
// ...Custom
});
// Application specific fields
const includeFields = [ 'Title', 'Author', 'Editor', 'Modified', 'Created' ];
const filter3 = `Hidden eq false and (ReadOnlyField eq false or (${
includeFields.map(field => `InternalName eq '${field}'`).join(' or ')
}))`;
list.fields.select('InternalName').filter(filter3).get().then(fields => {
console.log(`Application specific: ${fields.map(f => f.InternalName).join(', ')}`);
// Title, ...Custom, ContentType, Modified, Created, Author, Editor, Attachments
});
// Fields in a view
list.defaultView.fields.select('Items').get().then(f => {
const fields = (f as any).Items.results || (f as any).Items;
console.log(`Fields in a view: ${fields.join(', ')}`);
});
```
## Add Fields

@@ -55,0 +95,0 @@

8

package.json
{
"name": "@pnp/sp",
"version": "1.2.2",
"version": "1.2.3",
"description": "pnp - provides a fluent api for working with SharePoint REST",

@@ -11,5 +11,5 @@ "main": "./dist/sp.es5.umd.js",

"peerDependencies": {
"@pnp/common": "1.2.2",
"@pnp/logging": "1.2.2",
"@pnp/odata": "1.2.2"
"@pnp/common": "1.2.3",
"@pnp/logging": "1.2.3",
"@pnp/odata": "1.2.3"
},

@@ -16,0 +16,0 @@ "author": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc