Closed patrickblanc closed 6 months ago
3.x
3.23.0
SharePoint Framework
I have a specific class with internal sp object
constructor(private context: WebPartContext | ApplicationCustomizerContext) { this.spHttpClient = webpartContext.spHttpClient this.webUrl = webpartContext.pageContext.web.absoluteUrl this.language = webpartContext.pageContext.cultureInfo.currentUICultureName.toLowerCase() this.sp = spfi(getSharePointUrl()).using(SPFx(context)) }
I want to get pages from pages library that have specific term id (previously used term name but not efficient when multiple terms have same name).
const taxonomyList = this.sp.web.lists.getByTitle("TaxonomyHiddenList") const tags = await taxonomyList.items.select('Id').filter(`IdForTerm eq '${termId}'`)() console.log(tags)
Tags array is always empty...
const taxonomyList = this.sp.web.lists.getByTitle("TaxonomyHiddenList") const tags = await taxonomyList.items.select('Id')() console.log(tags)
Still empty.
I want to be able to get the term look up id from the taxonomy hidden list and then want to filter my pages list
const pagesLibrary = this.sp.web.lists.getByTitle("Websiteseiten") const result = await pagesLibrary.getItemsByCAMLQuery({ ViewXml: "<View><Query><Where><In><FieldRef LookupId='TRUE' Name='SbbSiteMapTerm'/><Values><Value Type='Integer'>39</Value></Values></In></Where></Query></View>" })
That is quite frustrating, beacuse same query in PowerShell using PnP is working fine.
Get-PnPListItem -List "Websiteseiten" -Query "<View><Query><Where><In><FieldRef LookupId='TRUE' Name='SbbSiteMapTerm'/><Values><Value Type='Integer'>39</Value></Values></In></Where></Query></View>"
Any idea why when i do this in my typescript application I cannot get any items from hidden taxonomy list and why ?
And querying pages library with caml query like this
const pagesLibrary = this.sp.web.lists.getByTitle("Websiteseiten") const result = await pagesLibrary.getItemsByCAMLQuery({ ViewXml: "<View><Query><Where><In><FieldRef LookupId='TRUE' Name='SbbSiteMapTerm'/><Values><Value Type='Integer'>39</Value></Values></In></Where></Query></View>" }) console.log(result)
Is throwing this : One or more fields are not installed correctly. Go to the list settings page.
Thank you for your hints, help !
Spfi() instead of spfi(wrongurl....) solved the problem.
This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.
What version of PnPjs library you are using
3.x
Minor Version Number
3.23.0
Target environment
SharePoint Framework
Additional environment details
I have a specific class with internal sp object
Question/Request
I want to get pages from pages library that have specific term id (previously used term name but not efficient when multiple terms have same name).
Tags array is always empty...
Still empty.
I want to be able to get the term look up id from the taxonomy hidden list and then want to filter my pages list
That is quite frustrating, beacuse same query in PowerShell using PnP is working fine.
Any idea why when i do this in my typescript application I cannot get any items from hidden taxonomy list and why ?
And querying pages library with caml query like this
Is throwing this : One or more fields are not installed correctly. Go to the list settings page.
Thank you for your hints, help !