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eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC;oBACpD,UAAU,EAAE,yBAAW,CAAC,mBAAmB,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC;iBACrE,CAAC,CAAC;YACL,CAAC;YAED,KAAI,CAAC,QAAQ,CAAC;gBACZ,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,MAAM;aACf,CAAC,CAAC;QACL,CAAC,EAAE,UAAC,KAAU;YACZ,KAAI,CAAC,QAAQ,CAAC;gBACZ,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,EAAE;aACX,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IACH,kBAAC;AAAD,CAzGA,AAyGC,CAzGwC,KAAK,CAAC,SAAS,GAyGvD","file":"webparts/workingWith/components/WorkingWith.js","sourcesContent":["import * as React from 'react';\n\nimport styles from '../WorkingWith.module.scss';\nimport { IWorkingWithWebPartProps } from '../IWorkingWithWebPartProps';\nimport { SPHttpClient, SPHttpClientConfiguration, SPHttpClientResponse, ODataVersion, ISPHttpClientConfiguration } from '@microsoft/sp-http';\nimport { SearchUtils, ISearchQueryResponse, IRow } from '../../SearchUtils';\nimport { Utils } from '../../Utils';\nimport {\n css,\n Persona,\n PersonaSize,\n PersonaPresence,\n Spinner\n} from 'office-ui-fabric-react';\n\nexport interface IWorkingWithProps extends IWorkingWithWebPartProps {\n httpClient: SPHttpClient;\n siteUrl: string;\n}\n\nexport interface IPerson {\n name: string;\n email: string;\n jobTitle: string;\n department: string;\n photoUrl: string;\n profileUrl: string;\n}\n\nexport interface IWorkingWithState {\n loading: boolean;\n people: IPerson[];\n error: string;\n}\n\nexport default class WorkingWith extends React.Component {\n constructor(props: IWorkingWithProps, state: IWorkingWithState) {\n super(props);\n\n this.state = {\n people: [],\n loading: true,\n error: null\n };\n }\n\n public componentDidMount(): void {\n this.loadPeople(this.props.siteUrl, this.props.numberOfPeople);\n }\n\n public componentDidUpdate(prevProps: IWorkingWithProps, prevState: IWorkingWithState, prevContext: any): void {\n if (this.props.numberOfPeople !== prevProps.numberOfPeople ||\n this.props.siteUrl !== prevProps.siteUrl && (\n this.props.numberOfPeople && this.props.siteUrl\n )) {\n this.loadPeople(this.props.siteUrl, this.props.numberOfPeople);\n }\n }\n\n public render(): JSX.Element {\n const loading: JSX.Element = this.state.loading ?
:
;\n const error: JSX.Element = this.state.error ?
Error: {this.state.error}
:
;\n const people: JSX.Element[] = this.state.people.map((person: IPerson, i: number) => {\n return (\n { this.navigateTo(person.profileUrl); } }\n key={person.email} />\n );\n });\n\n return (\n
\n
{this.props.title}
\n {loading}\n {error}\n {people}\n
\n );\n }\n\n private navigateTo(url: string): void {\n window.open(url, '_blank');\n }\n\n private loadPeople(siteUrl: string, numberOfPeople: number): void {\n this.props.httpClient.get(`${siteUrl}/_api/search/query?querytext='*'&properties='GraphQuery:actor(me\\\\,action\\\\:1019)'&selectproperties='Title,WorkEmail,JobTitle,Department,Path'&rowlimit=${numberOfPeople}`, SPHttpClient.configurations.v1 , {\n headers: {\n 'Accept': 'application/json;odata=nometadata',\n 'odata-version': ''\n }\n })\n .then((response: SPHttpClientResponse): Promise => {\n return response.json();\n })\n .then((response: ISearchQueryResponse): void => {\n if (!response ||\n !response.PrimaryQueryResult ||\n !response.PrimaryQueryResult.RelevantResults ||\n response.PrimaryQueryResult.RelevantResults.RowCount === 0) {\n this.setState({\n loading: false,\n error: null,\n people: []\n });\n return;\n }\n\n const people: IPerson[] = [];\n for (let i: number = 0; i < response.PrimaryQueryResult.RelevantResults.Table.Rows.length; i++) {\n const personRow: IRow = response.PrimaryQueryResult.RelevantResults.Table.Rows[i];\n const email: string = SearchUtils.getValueFromResults('WorkEmail', personRow.Cells);\n people.push({\n name: SearchUtils.getValueFromResults('Title', personRow.Cells),\n email: email,\n jobTitle: SearchUtils.getValueFromResults('JobTitle', personRow.Cells),\n department: SearchUtils.getValueFromResults('Department', personRow.Cells),\n photoUrl: Utils.getUserPhotoUrl(email, siteUrl, 'L'),\n profileUrl: SearchUtils.getValueFromResults('Path', personRow.Cells)\n });\n }\n\n this.setState({\n loading: false,\n error: null,\n people: people\n });\n }, (error: any): void => {\n this.setState({\n loading: false,\n error: error,\n people: []\n });\n });\n }\n}\n"],"sourceRoot":"..\\..\\..\\..\\src"}