How to use the odata.null function in odata

To help you get started, we’ve selected a few odata examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pnp / pnpjs / test / sp / features.ts View on Github external
it("site.features.add", async function () {

            // Check if feature is already active.
            const res = await sp.site.features.getById(siteFeatureId)();

            if (res["odata.null"]) {

                // Feature not active already
                return expect(sp.site.features.add(siteFeatureId)).to.be.eventually.fulfilled;
            } else {

                // Feature already active. Call should fail
                return expect(sp.site.features.add(siteFeatureId)).to.be.eventually.rejected;
            }
        });
github pnp / office365-cli / src / o365 / spo / commands / hubsite / hubsite-data-get.ts View on Github external
.then((res: any): void => {
        if (res['odata.null'] !== true) {
          cmd.log(JSON.parse(res.value));
        }
        else {
          if (this.verbose) {
            cmd.log(`${args.options.webUrl} is not connected to a hub site and is not a hub site itself`);
          }
        }

        if (this.verbose) {
          cmd.log(vorpal.chalk.green('DONE'));
        }

        cb();
      }, (err: any): void => this.handleRejectedODataJsonPromise(err, cmd, cb));
  }
github pnp / office365-cli / src / o365 / spo / commands / contenttype / contenttype-get.ts View on Github external
.then((res: any): void => {
        if (res['odata.null'] === true) {
          cb(new CommandError(`Content type with ID ${args.options.id} not found`));
          return;
        }

        cmd.log(res);

        if (this.verbose) {
          cmd.log(vorpal.chalk.green('DONE'));
        }

        cb();
      }, (err: any): void => this.handleRejectedODataJsonPromise(err, cmd, cb));
  }
github pnp / office365-cli / src / o365 / spo / commands / sitedesign / sitedesign-task-get.ts View on Github external
.then((res: SiteDesignTask): void => {
        if (!res["odata.null"]) {
          cmd.log(res);
        }

        if (this.verbose) {
          cmd.log(vorpal.chalk.green('DONE'));
        }

        cb();
      }, (err: any): void => this.handleRejectedODataJsonPromise(err, cmd, cb));
  }
github pnp / office365-cli / src / o365 / spo / commands / storageentity / storageentity-get.ts View on Github external
.then((property: TenantProperty): void => {
        if (property["odata.null"] === true) {
          if (this.verbose) {
            cmd.log(`Property with key ${args.options.key} not found`);
          }
        }
        else {
          cmd.log({
            Key: args.options.key,
            Value: property.Value,
            Description: property.Description,
            Comment: property.Comment
          });
        }
        cb();
      }, (err: any): void => this.handleRejectedPromise(err, cmd, cb));
  }
github pnp / office365-cli / src / o365 / spo / commands / customaction / customaction-get.ts View on Github external
.then((webResult: CustomAction): void => {
          if (webResult["odata.null"] !== true) {
            return resolve(webResult);
          }

          options.scope = "Site";
          this
            .getCustomAction(options)
            .then((siteResult: CustomAction): void => {
              return resolve(siteResult);
            }, (err: any): void => {
              reject(err);
            });
        }, (err: any): void => {
          reject(err);
github pnp / office365-cli / src / o365 / spo / commands / contenttype / contenttype-field-set.ts View on Github external
.then((res: FieldLink): Promise<{ SchemaXmlWithResourceTokens: string; }> => {
        if (res["odata.null"] !== true) {
          if (this.verbose) {
            cmd.log('Field link found');
          }
          this.fieldLink = res;
          return Promise.resolve(undefined as any);
        }

        if (this.verbose) {
          cmd.log('Field link not found. Creating...');
          cmd.log(`Retrieving information about site column ${args.options.fieldId}...`);
        }

        const requestOptions: any = {
          url: `${args.options.webUrl}/_api/web/fields('${args.options.fieldId}')?$select=SchemaXmlWithResourceTokens`,
          headers: {
            accept: 'application/json;odata=nometadata'
github pnp / office365-cli / src / o365 / spo / commands / customaction / customaction-set.ts View on Github external
.then((webResult: CustomAction | undefined): void => {
          if (webResult === undefined || webResult["odata.null"] !== true) {
            return resolve(webResult);
          }

          options.scope = "Site";
          this
            .updateCustomAction(options)
            .then((siteResult: CustomAction | undefined): void => {
              return resolve(siteResult);
            }, (err: any): void => {
              reject(err);
            });
        }, (err: any): void => {
          reject(err);
github pnp / office365-cli / src / o365 / spo / commands / contenttype / contenttype-remove.ts View on Github external
.then((res): void => {
          if (res && res["odata.null"] === true) {
            cb(new CommandError(`Content type not found`));
            return;
          }
          else {
            if (this.verbose) {
              cmd.log(vorpal.chalk.green('DONE'));
            }
          }

          cb();
        }, (err: any): void => {
          this.handleRejectedODataJsonPromise(err, cmd, cb);
github pnp / office365-cli / src / o365 / spo / commands / customaction / customaction-set.ts View on Github external
.then((customAction: CustomAction | undefined): void => {
        if (this.verbose) {
          if (customAction && customAction["odata.null"] === true) {
            cmd.log(`Custom action with id ${args.options.id} not found`);
          } else {
            cmd.log(vorpal.chalk.green('DONE'));
          }
        }
        cb();
      }, (err: any): void => this.handleRejectedPromise(err, cmd, cb));
  }

odata

o.js is a isomorphic Odata Javascript library to simplify the request of data. The main goal is to build a standalone, lightweight and easy to understand Odata lib.

MIT
Latest version published 8 months ago

Package Health Score

65 / 100
Full package analysis