This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "@odata.context": "https://chrisobriensp.sharepoint.com/sites/team1/_api/$metadata#SitePageMetadatas", | |
| "value": [{ | |
| "@odata.editLink": "SP.Publishing.SitePageMetadata52f99f8b-a261-4372-a468-884f1933e8e4", | |
| "@odata.id": "https://chrisobriensp.sharepoint.com/sites/team1/_api/SP.Publishing.SitePageMetadata52f99f8b-a261-4372-a468-884f1933e8e4", | |
| "@odata.type": "#SP.Publishing.SitePageMetadata", | |
| "AbsoluteUrl": "https://chrisobriensp.sharepoint.com/sites/team1/SitePages/Facebook details plans to combat.aspx", | |
| "BannerImageUrl": "https://chrisobriensp.sharepoint.com/sites/team1/SiteAssets/SitePages/Facebook-details-plans-to-combat/54483-Facebook.jpg, https://chrisobriensp.sharepoint.com/sites/team1/SiteAssets/SitePages/Facebook-details-plans-to-combat/54483-Facebook.jpg", | |
| "CreatedBy": { | |
| "@odata.editLink": "SP.Publishing.SitePageMetadata52f99f8b-a261-4372-a468-884f1933e8e4/CreatedBy", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private fetchOptionsSimple(): Array<IPropertyPaneDropdownOption> { | |
| var options: Array<IPropertyPaneDropdownOption> = new Array<IPropertyPaneDropdownOption>(); | |
| options.push( { key: 'Added1', text: 'Added from code 1' }); | |
| options.push( { key: 'Added2', text: 'Added from code 2' }); | |
| return options; | |
| } | |
| protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration { | |
| var fetchedOptions: Array<IPropertyPaneDropdownOption> = this.fetchOptions(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private asyncTextBoxValidationMethod(value: string): Promise<string> { | |
| if (value !== undefined && value.length > 3) { | |
| var url = this.context.pageContext.web.absoluteUrl + `/_api/web/lists?$filter=Hidden eq false`; | |
| return this.fetchLists(url).then((response) => { | |
| var lists: ISPList[] = response.value; | |
| var foundList: boolean = false; | |
| lists.forEach((list: ISPList) => { | |
| if (value === list.Title) { | |
| foundList = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration { | |
| if (!this.listsFetched) { | |
| this.fetchOptions().then((response) => { | |
| this.dropdownOptions = response; | |
| this.listsFetched = true; | |
| // now refresh the property pane, now that the promise has been resolved.. | |
| this.onDispose(); | |
| }); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* need some imports e.g.: | |
| import { IODataList } from '@microsoft/sp-odata-types'; | |
| import { SPHttpClient, SPHttpClientConfigurations, SPHttpClientConfiguration, SPHttpClientResponse, ODataVersion, ISPHttpClientConfiguration } from '@microsoft/sp-http'; | |
| */ | |
| private dropdownOptions: IPropertyPaneDropdownOption[]; | |
| private listsFetched: boolean; | |
| // these methods are split out to go step-by-step, but you could refactor and be more direct if you choose.. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration { | |
| return { | |
| pages: [ | |
| { | |
| header: { | |
| description: "Basic settings" | |
| }, | |
| groups: [ | |
| { | |
| groupName: "Look and feel", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // shows function first, then calling code below - note two functions are used here.. | |
| public GetResultsFromHttpClient (context: IWebPartContext, url: string): Promise<ISharePointSearchResults> { | |
| return context.httpClient.get(url, { | |
| // workaround for httpClient/search API issue.. | |
| headers: { | |
| "odata-version": "" | |
| }}).then((response: Response) => { | |
| if (response.ok) { | |
| console.log("Returned OK from httpClient"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // shows function first, then calling code below.. | |
| export default class Search { | |
| public GetResultsFromjQueryAjax(query: string, rowLimit: number): Promise<ISearchResult> { | |
| var self: Search = this; | |
| return new Promise<ISearchResult>((resolve, reject) => { | |
| var results: SearchResult[] = new Array(); | |
| var url = self.getSearchUrl(query, rowLimit); |