pnp / pnpjs

Fluent JavaScript API for SharePoint and Microsoft Graph REST APIs
https://pnp.github.io/pnpjs/
Other
753 stars 304 forks source link

@pnp/sp/taxonomy error #2977

Closed Ricardowdl closed 6 months ago

Ricardowdl commented 6 months ago

Major Version

2.x (No longer supported)

Minor Version Number

2.7.0

Target environment

SharePoint Framework

Additional environment details

Sharepoint 2019 SPFx PnPJs - 2.7.0

Expected or Desired Behavior

I wish to call sp.termStore() and i try pnp-v2 and pnp-v3 document , but got an 500 error.

Observed Behavior

fetch("http://udi-sharepoint/sites/hkma/_api/v2.1/termstore", { "headers": { "accept": "application/json", "accept-language": "zh-TW,zh;q=0.9,en-US;q=0.8,en;q=0.7", "cache-control": "no-cache", "content-type": "application/json;odata=verbose;charset=utf-8", "pragma": "no-cache", "x-clientservice-clienttag": "PnPCoreJS:2.15.0:" }, "referrer": "http://udi-sharepoint/sites/hkma/Lists/Reserves%20Management%20Filing%20System/NewForm.aspx?Source=http%3A%2F%2Fudi%2Dsharepoint%2Fsites%2Fhkma%2FLists%2FReserves%2520Management%2520Filing%2520System%2FAllItems%2Easpx%23InplviewHash5eb1d5aa%2D9047%2D4b3b%2D8a0f%2Da25f0addf9af%3D&RootFolder=", "referrerPolicy": "strict-origin-when-cross-origin", "body": null, "method": "GET", "mode": "cors", "credentials": "include" });

Could not load file or assembly 'WinLive.SkyShared.Infrastructure.Utilities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=6826d94a3ff89317' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Steps to Reproduce

import { sp } from "@pnp/sp";
import "@pnp/sp/taxonomy";
import { ITermStoreInfo } from "@pnp/sp/taxonomy";

export async function getTag() {
    const info: ITermStoreInfo = await sp.termStore();
    console.log('info', info)
}
juliemturner commented 6 months ago

The V2.1 endpoints are for SharePoint online and don't exist in SharePoint 2019 on prem. I assuming you're using SPFx version 1.4.1... and if that's the case you need to use PnPjs v2 (as you indicated). That uses the older taxonomy apis... documentation is here: https://pnp.github.io/pnpjs/v2/sp/taxonomy/

bcameron1231 commented 6 months ago

Closing this issue as answered. If you have additional questions or we did not answer your question, please open a new issue, ref this issue, and provide any additional details available. Thank you!

github-actions[bot] commented 6 months ago

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.