Forum Discussion
SharePoint Framework and existing webparts
Hello Paul,
Thank you for the references.
I tried using the search api by changing the query in https://dev.office.com/sharepoint/docs/spfx/web-parts/get-started/connect-to-sharepoint. However, I am not able to get the proper response. I am using the following code. Can you possibly tell, what I could be doing wrong?
Code:
const spSearchConfig: ISPHttpClientConfiguration = {
defaultODataVersion: ODataVersion.v3
};
const clientConfigODataV3: SPHttpClientConfiguration = SPHttpClient.configurations.v1.overrideWith(spSearchConfig);
private _getListData(): Promise<ISPLists> {
return this.context.spHttpClient.get(this.context.pageContext.web.absoluteUrl + `/_api/search/query?contentclass:sts_web`, clientConfigODataV3)
.then((response: SPHttpClientResponse) => {
return response.json();
});
}
Thank you.