Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import Web is not working for accessing another site in SPFX #790

Open
Hub-GHS opened this issue Jun 19, 2023 · 0 comments
Open

Import Web is not working for accessing another site in SPFX #790

Hub-GHS opened this issue Jun 19, 2023 · 0 comments

Comments

@Hub-GHS
Copy link

Hub-GHS commented Jun 19, 2023

Type of issue

The below code works fine on lists in the same site collection, but not on lists in a different site collection

Using the below in package.json

"@pnp/common": "1.3.3",
"@pnp/logging" :"1.3.3",

"@pnp/odata":"1.3.3",

"@pnp/sp":"1.3.3"


import { sp, Web } from '@pnp/sp';

const targetSiteCollectionUrl = "https://anothersitecollectionURL";

const web = new Web(targetSiteCollectionUrl);

sp.setup({
sp: {
baseUrl: targetSiteCollectionUrl,
},
});

let listItems = await web.lists.getByTitle("TeamInfo").items.get();

console.log(listItems.length);


My environment

Windows 10 64-bit
Node Version v10.24.1
NPM Version - 6.14.2
yo - 3.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant