0

How can i get all installed custom apps in a web with appweburl in spfx webpart.

5

You can get all webs including appwebs with :

<SiteURL>/_api/web/webs

You will get the app webs with their url.

For your SPFX webpart you can get all webs like:

private getAllWebs(): Promise<number> {
    return new Promise<number>((resolve: (title: string) => void, reject: (error: any) => void): void => {
      this.context.spHttpClient.get(`${this.context.pageContext.web.absoluteUrl}/_api/web/webs`,
        SPHttpClient.configurations.v1,
        {
          headers: {
            'Accept': 'application/json;odata=nometadata',
            'odata-version': ''
          }
        })
        .then((response: SPHttpClientResponse): Promise<{ value: { Title: string }[] }> => {
          return response.json();
        }, (error: any): void => {
          reject(error);
        })
        .then((response: { value: { Title: string }[] }): void => {

        });
    });
  }

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.