Library: 1.2.8
SharePoint: SharePoint Online
Not sure if I missed it looking through the documentation, but it'd be great if the SP_TenantSettings_Current endpoint was exposed through this library. I find myself having to manually call the endpoint to get the URL of the tenant app catalog site collection, while doing everything else within the library.
My current use case is adding a list to the tenant app catalog site collection without knowing the URL or site name.
We have the getAppCatalog and getSiteCollectionAppCatalog methods available, is that what you are looking for?
@patrick-rodgers those give me access to the AppCatalog object, but what I need is the Web that the app catalog is in. The SP_TenantSettings_Current endpoint gives me the URL of the App Catalog site collection, and I can then use that to access the web, but I'm just hoping to do something like that through this library.
does creating a new web with that url not work?
import { Web } from "@pnp/sp";
const web = new Web("{The url of the web}");
Edit: I am not understanding what you are trying to do. If you could pseudo code it or otherwise give me an example we can always look at adding things.
There is endpoint https://contoso.sharepoint.com/_api/SP_TenantSettings_Current which returns:
```xml
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:georss="http://www.georss.org/georss"
xmlns:gml="http://www.opengis.net/gml">
@patrick-rodgers Ideally, the library would expose a function (like getTenantAppCatalogWeb) that returned the Web of the app catalog without having to know the url. It would work similarly to getAppCatalog, but return the entire Web instead of just the AppCatalog.
The URL I'm referencing (which @tavikukko posted the response from) gives you the App Catalog site collection URL. This is why I know it's possible.
At it's most basic, I'm asking for a way to hit this endpoint through this library. Right now, I have to do something like this:
const appCatalogWeb = new Web(
await fetch(https://contoso.sharepoint.com/_api/SP_TenantSettings_Current)
.then(res => res.json())
.then(body => body.CorporateCatalogUrl)
)
Gotcha, thanks @lworkman & @tavikukko for some reason it just wasn't clicking for me. Sure we can look at adding something for this. Thanks for the explanation and the idea!
Done, will be immediately off the sp import:
sp.getTenantAppCatalogWeb().then(r => {
r.get().then(t => {
console.log(JSON.stringify(t, null, 2));
});
});
Have a look at the code, things like this make a great first PR as there isn't too much to it.
Thank you for the fast PR! Really appreciate it.
Most helpful comment
Gotcha, thanks @lworkman & @tavikukko for some reason it just wasn't clicking for me. Sure we can look at adding something for this. Thanks for the explanation and the idea!