I'm using @pnp in my SPFX project, and I need to get tenant property. The code is as followed:

      .then((prop: StorageEntity) => {
    //How do I handle odata.null?
      return prop.value;

If the key doesn't exist the results I get back is

Object {odata.metadata: "https://_________.sharepoint.com/sites/ASite/_a…", odata.null: true} odata.metadata:"https://________.sharepoint.com/sites/ASite/_api/$metadata#Edm.Null" odata.null:true proto:Object {constructor: , defineGetter: , defineSetter: , …}

I've tried to check odata.null value but it doesn't appear to be there. So how do I check for invalid key?

1 Answer 1


You can check odata.null in the prop object itself.

Using this snippet you can check for invalid key:

      .then((prop: StorageEntity) => {


          // storage entity doesnt exist

          // do something (like create entity or return empty string)
          return "";

        // storage entity exists, return its value
        return prop.Value;
  • 1
    Thank you. These documentations always shows the happy path, but never how to handle issues. Commented Aug 14, 2018 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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