3

Is there a way to get the property bags using PnP-JS-Core? There is nothing about it in the documentation or blogs that I've found in google.

Using REST the call is: http://sitecollection/site/_api/web/allProperties

Since PnP-JS-Core is based on REST calls I would think there is a way.

Somebody knows?

6

You need to use it as below in typescript:

pnp.Web(this.url).select("Title", "AllProperties").expand("AllProperties").get().then(r =>{    
    console.log(r);
});

So pure javascript would be as below:

$pnp.sp.web.select("AllProperties").expand("AllProperties").get().then(function(result){  
    // Select the AllProperties from the result
    console.log(result["AllProperties"].MyVarInThePropertyBag);
});

Result is as below in console

enter image description here

  • Thank you very much Gautam, I got in the right direction with your answer. I'm editing your answer in pure javascript in case somebody else has the same doubt – yngrdyn Jan 10 '17 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.