@pnp/sp
- Version 4.17.0
- Published
- 1.17 MB
- 3 dependencies
- MIT license
Install
npm i @pnp/spyarn add @pnp/sppnpm add @pnp/spOverview
pnp - provides a fluent api for working with SharePoint REST
Index
Variables
Functions
- containsInvalidFileFolderChars()
- createChangeToken()
- DefaultHeaders()
- DefaultInit()
- defaultPath()
- deleteable()
- deleteableWithETag()
- encodePath()
- encodePathNoURIEncode()
- extractWebUrl()
- odataUrlFrom()
- RequestDigest()
- SPBrowser()
- spDelete()
- spfi()
- SPFx()
- SPFxToken()
- spGet()
- spInvokableFactory()
- spPatch()
- spPost()
- spPostDelete()
- spPostDeleteETag()
- spPostMerge()
- stripInvalidFileFolderChars()
- Telemetry()
- toResourcePath()
Classes
Interfaces
Enums
Type Aliases
Variables
variable emptyGuid
const emptyGuid: string;variable SPCollection
const SPCollection: ISPInvokableFactory<ISPCollection<any[]>>;variable SPInstance
const SPInstance: ISPInvokableFactory<ISPInstance<any>>;variable SPQueryable
const SPQueryable: ISPInvokableFactory<ISPQueryable<any>>;Functions
function containsInvalidFileFolderChars
containsInvalidFileFolderChars: (input: string, onPremise?: boolean) => boolean;Checks if file or folder name contains invalid characters
Parameter input
File or folder name to check
Parameter onPremise
Set to true for SharePoint On-Premise
Returns
True if contains invalid chars, false otherwise
function createChangeToken
createChangeToken: ( resourceType: 'site' | 'web' | 'list', resource: string, tokenDate?: Date, versionNumber?: number) => IChangeToken;Creates a change token for use with sites, webs, or lists
Parameter resourceType
The type of resource for which you want a change token
Parameter resource
The identifier (GUID) of the resource site.Id, web.Id, or List.Id
Parameter tokenDate
The date for this token (if start token, start date of chages; if end token, end date of the changes)
Parameter versionNumber
Version number for token (default = 1)
Returns
A properly formatted change token
function DefaultHeaders
DefaultHeaders: () => TimelinePipe<Queryable>;function DefaultInit
DefaultInit: () => TimelinePipe<Queryable>;function defaultPath
defaultPath: ( path: string) => <T extends new (...args: any[]) => {}>( target: T) => (new (...args: any[]) => {}) & T;Decorator used to specify the default path for SPQueryable objects
Parameter path
function deleteable
deleteable: () => (this: ISPQueryable) => Promise<void>;Adds the a delete method to the tagged class taking no parameters and calling spPostDelete
function deleteableWithETag
deleteableWithETag: () => (this: ISPQueryable, eTag?: string) => Promise<void>;function encodePath
encodePath: (value: string) => string;Encodes path portions of SharePoint urls such as decodedUrl=
encodePath(pathStr)Parameter value
The string path to encode
Returns
A path encoded for use in SP urls
function encodePathNoURIEncode
encodePathNoURIEncode: (value: string) => string;function extractWebUrl
extractWebUrl: (candidateUrl: string) => string;function odataUrlFrom
odataUrlFrom: (candidate: any) => string;function RequestDigest
RequestDigest: ( hook?: (url: string, init: RequestInit) => IDigestInfo | null | undefined) => TimelinePipe<Queryable>;function SPBrowser
SPBrowser: (props?: ISPBrowserProps) => TimelinePipe<Queryable>;function spDelete
spDelete: <T = any>(o: ISPQueryable<any>, init?: RequestInit) => Promise<T>;function spfi
spfi: (root?: SPInit | SPFI) => SPFI;function SPFx
SPFx: (context: ISPFXContext) => TimelinePipe<Queryable>;function SPFxToken
SPFxToken: (context: ISPFXContext) => TimelinePipe<Queryable>;function spGet
spGet: <T = any>(o: ISPQueryable<any>, init?: RequestInit) => Promise<T>;function spInvokableFactory
spInvokableFactory: <R extends ISPQueryable<any>>( f: any) => ISPInvokableFactory<R>;function spPatch
spPatch: <T = any>(o: ISPQueryable<any>, init?: RequestInit) => Promise<T>;function spPost
spPost: <T = any>(o: ISPQueryable<any>, init?: RequestInit) => Promise<T>;function spPostDelete
spPostDelete: <T = any>(o: ISPQueryable<any>, init?: RequestInit) => Promise<T>;function spPostDeleteETag
spPostDeleteETag: <T = any>( o: ISPQueryable<any>, init?: RequestInit, eTag?: string) => Promise<T>;function spPostMerge
spPostMerge: <T = any>(o: ISPQueryable<any>, init?: RequestInit) => Promise<T>;function stripInvalidFileFolderChars
stripInvalidFileFolderChars: ( input: string, replacer?: string, onPremise?: boolean) => string;Removes invalid characters from file or folder name
Parameter input
File or folder name
Parameter replacer
Value that will replace invalid characters
Parameter onPremise
Set to true for SharePoint On-Premise
Returns
File or folder name with replaced invalid characters
function Telemetry
Telemetry: () => TimelinePipe<Queryable>;function toResourcePath
toResourcePath: (url: string) => IResourcePath;Classes
class ComparisonResult
class ComparisonResult<T> extends BaseQuery {}method and
and: { (): QueryableAndResult<T>; ( ...queries: ( | ComparisonResult<T> | ((f: QueryableFields<T>) => ComparisonResult<T>) )[] ): ComparisonResult<T>;};method or
or: { (): QueryableOrResult<T>; ( ...queries: ( | ComparisonResult<T> | ((f: QueryableFields<T>) => ComparisonResult<T>) )[] ): ComparisonResult<T>;};method toString
toString: () => string;class InitialFieldQuery
class InitialFieldQuery<T> extends QueryableFields<T> {}method and
and: { (): QueryableFields<T>; ( ...queries: ( | ComparisonResult<T> | ((f: QueryableFields<T>) => ComparisonResult<T>) )[] ): ComparisonResult<T>;};method or
or: { (): QueryableFields<T>; ( ...queries: ( | ComparisonResult<T> | ((f: QueryableFields<T>) => ComparisonResult<T>) )[] ): ComparisonResult<T>;};class SPFI
class SPFI {}constructor
constructor(root?: SPInit);Creates a new instance of the SPFI class
Parameter root
Establishes a root url/configuration
method create
protected create: <T extends ISPQueryable<any>>( factory: (q: ISPQueryable, path?: string) => T, path?: string) => T;Used by extending classes to create new objects directly from the root
Parameter factory
The factory for the type of object to create
Returns
A configured instance of that object
method using
using: (...behaviors: TimelinePipe[]) => this;Applies one or more behaviors which will be inherited by all instances chained from this root
Interfaces
interface IChangeQuery
interface IChangeQuery {}Defines a query that is performed against the change log.
property Add
Add?: boolean;Gets or sets a value that specifies whether add changes are included in the query.
property Alert
Alert?: boolean;Gets or sets a value that specifies whether changes to alerts are included in the query.
property ChangeTokenEnd
ChangeTokenEnd?: IChangeToken;Gets or sets a value that specifies the end date and end time for changes that are returned through the query.
property ChangeTokenStart
ChangeTokenStart?: IChangeToken;Gets or sets a value that specifies the start date and start time for changes that are returned through the query.
property ContentType
ContentType?: boolean;Gets or sets a value that specifies whether changes to content types are included in the query.
property DeleteObject
DeleteObject?: boolean;Gets or sets a value that specifies whether deleted objects are included in the query.
property Field
Field?: boolean;Gets or sets a value that specifies whether changes to fields are included in the query.
property File
File?: boolean;Gets or sets a value that specifies whether changes to files are included in the query.
property Folder
Folder?: boolean;Gets or sets value that specifies whether changes to folders are included in the query.
property Group
Group?: boolean;Gets or sets a value that specifies whether changes to groups are included in the query.
property GroupMembershipAdd
GroupMembershipAdd?: boolean;Gets or sets a value that specifies whether adding users to groups is included in the query.
property GroupMembershipDelete
GroupMembershipDelete?: boolean;Gets or sets a value that specifies whether deleting users from the groups is included in the query.
property Item
Item?: boolean;Gets or sets a value that specifies whether general changes to list items are included in the query.
property List
List?: boolean;Gets or sets a value that specifies whether changes to lists are included in the query.
property Move
Move?: boolean;Gets or sets a value that specifies whether move changes are included in the query.
property Navigation
Navigation?: boolean;Gets or sets a value that specifies whether changes to the navigation structure of a site collection are included in the query.
property Rename
Rename?: boolean;Gets or sets a value that specifies whether renaming changes are included in the query.
property Restore
Restore?: boolean;Gets or sets a value that specifies whether restoring items from the recycle bin or from backups is included in the query.
property RoleAssignmentAdd
RoleAssignmentAdd?: boolean;Gets or sets a value that specifies whether adding role assignments is included in the query.
property RoleAssignmentDelete
RoleAssignmentDelete?: boolean;Gets or sets a value that specifies whether adding role assignments is included in the query.
property RoleDefinitionAdd
RoleDefinitionAdd?: boolean;Gets or sets a value that specifies whether adding role assignments is included in the query.
property RoleDefinitionDelete
RoleDefinitionDelete?: boolean;Gets or sets a value that specifies whether adding role assignments is included in the query.
property RoleDefinitionUpdate
RoleDefinitionUpdate?: boolean;Gets or sets a value that specifies whether adding role assignments is included in the query.
property SecurityPolicy
SecurityPolicy?: boolean;Gets or sets a value that specifies whether modifications to security policies are included in the query.
property Site
Site?: boolean;Gets or sets a value that specifies whether changes to site collections are included in the query.
property SystemUpdate
SystemUpdate?: boolean;Gets or sets a value that specifies whether updates made using the item SystemUpdate method are included in the query.
property Update
Update?: boolean;Gets or sets a value that specifies whether update changes are included in the query.
property User
User?: boolean;Gets or sets a value that specifies whether changes to users are included in the query.
property View
View?: boolean;Gets or sets a value that specifies whether changes to views are included in the query.
property Web
Web?: boolean;Gets or sets a value that specifies whether changes to Web sites are included in the query.
interface IChangeToken
interface IChangeToken {}Represents the unique sequential location of a change within the change log.
property StringValue
StringValue: string;Gets or sets a string value that contains the serialized representation of the change token generated by the protocol server.
interface IDeleteable
interface IDeleteable {}method delete
delete: () => Promise<void>;Delete this instance
interface IDeleteableWithETag
interface IDeleteableWithETag {}method delete
delete: (eTag?: string) => Promise<void>;Delete this instance
Parameter eTag
Value used in the IF-Match header, by default "*"
interface IMoveCopyOptions
interface IMoveCopyOptions {}Contains options used to modify the behaviour of a move or copy operation
property KeepBoth
KeepBoth: boolean;Boolean specifying whether to rename and copy the source file when the destination file exists
property ResetAuthorAndCreatedOnCopy
ResetAuthorAndCreatedOnCopy: boolean;Boolean specifying whether to reset the destination of the copy author to the current user and the created by datetime to the current time.
property RetainEditorAndModifiedOnMove
RetainEditorAndModifiedOnMove: boolean;Boolean specifying whether to retain the source of the move's editor and modified by datetime.
property ShouldBypassSharedLocks
ShouldBypassSharedLocks: boolean;Boolean specifying whether to allow File and Folder Move operations when file contain co-authoring shared locks
interface IPrincipalInfo
interface IPrincipalInfo {}property Department
Department: string;property DisplayName
DisplayName: string;property Email
Email: string;property JobTitle
JobTitle: string;property LoginName
LoginName: string;property Mobile
Mobile: string;property PrincipalId
PrincipalId: number;property PrincipalType
PrincipalType: PrincipalType;property SIPAddress
SIPAddress: string;interface IResourcePath
interface IResourcePath {}property DecodedUrl
DecodedUrl: string;interface ISPBrowserProps
interface ISPBrowserProps {}property baseUrl
baseUrl?: string;interface ISPCollection
interface ISPCollection<GetType = any[]> extends _SPCollection<GetType> {}interface ISPConstructor
interface ISPConstructor<T extends ISPQueryable = ISPQueryable> {}construct signature
new (base: SPInit, path?: string): T;interface ISPFXContext
interface ISPFXContext {}property aadTokenProviderFactory
aadTokenProviderFactory?: { getTokenProvider(): Promise<{ getToken(resource: string): Promise<string>; }>;};property pageContext
pageContext: { web: { absoluteUrl: string; }; legacyPageContext: { formDigestTimeoutSeconds: number; formDigestValue: string; };};interface ISPInstance
interface ISPInstance<GetType = any> extends _SPInstance<GetType> {}interface ISPQueryable
interface ISPQueryable<GetType = any> extends _SPQueryable<GetType> {}interface SPFI
interface SPFI {}method batched
batched: (props?: ISPBatchProps) => [SPFI, () => Promise<void>];Creates a batch behavior and associated execute function
interface SPFI
interface SPFI {}property tenantAppcatalog
tenantAppcatalog: IAppCatalog;method getTenantAppCatalogWeb
getTenantAppCatalogWeb: () => Promise<IWeb>;interface SPFI
interface SPFI {}property groupSiteManager
readonly groupSiteManager: IGroupSiteManager;interface SPFI
interface SPFI {}property hubSites
readonly hubSites: IHubSites;Lists all of the subsites
interface SPFI
interface SPFI {}property navigation
readonly navigation: INavigationService;interface SPFI
interface SPFI {}property publishingSitePageService
readonly publishingSitePageService: ISitePageService;Access to SP.Publishing.SitePageService API which allows you to get your current unified group memberships
interface SPFI
interface SPFI {}method search
search: (query: SearchQueryInit) => Promise<SearchResults>;Conduct a search
Parameter query
Parameters for the search
method searchSuggest
searchSuggest: (query: string | ISuggestQuery) => Promise<ISuggestResult>;Conduct a suggest search query
Parameter query
Parameters for the search
interface SPFI
interface SPFI {}property siteDesigns
readonly siteDesigns: ISiteDesigns;interface SPFI
interface SPFI {}property siteScripts
readonly siteScripts: ISiteScripts;Enums
enum PageType
enum PageType { Invalid = -1, DefaultView = 0, NormalView = 1, DialogView = 2, View = 3, DisplayForm = 4, DisplayFormDialog = 5, EditForm = 6, EditFormDialog = 7, NewForm = 8, NewFormDialog = 9, SolutionForm = 10, PAGE_MAXITEMS = 11,}member DefaultView
DefaultView = 0member DialogView
DialogView = 2member DisplayForm
DisplayForm = 4member DisplayFormDialog
DisplayFormDialog = 5member EditForm
EditForm = 6member EditFormDialog
EditFormDialog = 7member Invalid
Invalid = -1member NewForm
NewForm = 8member NewFormDialog
NewFormDialog = 9member NormalView
NormalView = 1member PAGE_MAXITEMS
PAGE_MAXITEMS = 11member SolutionForm
SolutionForm = 10member View
View = 3enum PrincipalSource
enum PrincipalSource { None = 0, UserInfoList = 1, Windows = 2, MembershipProvider = 4, RoleProvider = 8, All = 15,}Specifies the source of a principal.
member All
All = 15Enumeration whose value specifies all principal sources.
member MembershipProvider
MembershipProvider = 4Enumeration whose value specifies the current membership provider as the principal source.
member None
None = 0Enumeration whose value specifies no principal source.
member RoleProvider
RoleProvider = 8Enumeration whose value specifies the current role provider as the principal source.
member UserInfoList
UserInfoList = 1Enumeration whose value specifies user information list as the principal source.
member Windows
Windows = 2Enumeration whose value specifies Active Directory as the principal source.
enum PrincipalType
enum PrincipalType { None = 0, User = 1, DistributionList = 2, SecurityGroup = 4, SharePointGroup = 8, All = 15,}Specifies the type of a principal.
member All
All = 15Enumeration whose value specifies all principal types.
member DistributionList
DistributionList = 2Enumeration whose value specifies a distribution list as the principal type.
member None
None = 0Enumeration whose value specifies no principal type.
member SecurityGroup
SecurityGroup = 4Enumeration whose value specifies a security group as the principal type.
member SharePointGroup
SharePointGroup = 8Enumeration whose value specifies a group as the principal type.
member User
User = 1Enumeration whose value specifies a user as the principal type.
Type Aliases
type ISPInvokableFactory
type ISPInvokableFactory<R extends ISPQueryable> = ( base: SPInit, path?: string) => R & IInvokable;type SPInit
type SPInit = string | ISPQueryable | [ISPQueryable, string];Package Files (30)
- appcatalog/index.d.ts
- batching.d.ts
- behaviors/defaults.d.ts
- behaviors/request-digest.d.ts
- behaviors/spbrowser.d.ts
- behaviors/spfx.d.ts
- behaviors/telemetry.d.ts
- decorators.d.ts
- fi.d.ts
- groupsitemanager/index.d.ts
- hubsites/index.d.ts
- index.d.ts
- navigation/index.d.ts
- profiles/index.d.ts
- publishing-sitepageservice/index.d.ts
- search/index.d.ts
- site-designs/index.d.ts
- site-scripts/index.d.ts
- sites/index.d.ts
- social/index.d.ts
- spqueryable.d.ts
- sputilities/index.d.ts
- types.d.ts
- utils/create-change-token.d.ts
- utils/encode-path-str.d.ts
- utils/extract-web-url.d.ts
- utils/file-names.d.ts
- utils/odata-url-from.d.ts
- utils/to-resource-path.d.ts
- webs/index.d.ts
Dependencies (3)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@pnp/sp.
- Markdown[](https://www.jsdocs.io/package/@pnp/sp)
- HTML<a href="https://www.jsdocs.io/package/@pnp/sp"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 5790 ms. - Missing or incorrect documentation? Open an issue for this package.
