Forum Discussion
Mike Jansen
Oct 11, 2017Iron Contributor
SPFX > pnp.sp reference in React project
I have a working SPFX project using pnp.sp.search (without an additional javascript framework). I import pnp.sp like this in my webparts.ts file : import * as pnp from 'sp-pnp-js';
import { SearchQ...
Mike Jansen
Oct 11, 2017Iron Contributor
The stange thing is that when I right-mouse click om "SearchQuery" it does not find a definition.
I imported it like this:
import { SearchQuery, SearchResults } from 'sp-pnp-js';SearchResults, however, does go to the right definition
Maggan Wåhlin
Oct 11, 2017Iron Contributor
If you haven´t read this, it might help.
https://github.com/SharePoint/PnP-JS-Core/wiki/Working-With:-Search
You can use several methods to achieve what you need. In my web part, I don´t use SearchQuery:
pnp.sp.search(this.props.searchText).then((r: SearchResults) => {
// do something
});
https://github.com/SharePoint/PnP-JS-Core/wiki/Working-With:-Search
You can use several methods to achieve what you need. In my web part, I don´t use SearchQuery:
pnp.sp.search(this.props.searchText).then((r: SearchResults) => {
// do something
});
- Mike JansenOct 11, 2017Iron Contributor
Thanks, will have a look.
However, my search is somewhat more complex. Need a refinement and some more properties in my result. Have not figured out how to achieve that with you syntax. Is this possible using your syntax?