{
+ return (
+
+ {this.props.targetEmail ? '' : (
+ Target email is empty! Please configure this web part first.
+ )}
+ {this.state.messageSended ? (
+
+ {
+ this.setState({
+ messageSended:false
+ });
+ }}>I want to send more!
+
+ }
+ messageBarType={MessageBarType.success}
+ isMultiline={false}
+ >
+ Message was sent!
+
+ ) :
+ (
+ <>
+
+
+ Send
+
+ >
+ )}
+
+ );
+ }
+
+ private _onChange = (event: React.ChangeEvent) : void => {
+ this.setState({message:event.target.value});
+ }
+
+ private _sendMessage = async (event: React.MouseEvent) : Promise => {
+ this.setState({isBusy:true});
+
+ const msg = {
+ subject: escape(this.props.subject),
+ importance:"low",
+ body:{
+ contentType:"html",
+ content: escape(this.state.message)
+ },
+ toRecipients:[
+ {
+ emailAddress:{
+ address: this.props.targetEmail
+ }
+ }
+ ]
+ } as MicrosoftGraph.Message;
+
+ await this.props.graphClient.api('/me/sendMail')
+ .post({
+ message : msg
+ }).then(() => {
+ this.setState({
+ isBusy:false,
+ message: '',
+ messageSended: true
+ });
+ },(error: any) => {
+ console.log(error);
+ });
+ }
+}
diff --git a/samples/react-graph-feedback-form/src/webparts/feedbackForm/components/IFeedbackFormProps.ts b/samples/react-graph-feedback-form/src/webparts/feedbackForm/components/IFeedbackFormProps.ts
new file mode 100644
index 000000000..fca379371
--- /dev/null
+++ b/samples/react-graph-feedback-form/src/webparts/feedbackForm/components/IFeedbackFormProps.ts
@@ -0,0 +1,7 @@
+import { MSGraphClient } from '@microsoft/sp-http';
+
+export interface IFeedbackFormProps {
+ graphClient: MSGraphClient;
+ targetEmail: string;
+ subject: string;
+}
diff --git a/samples/react-graph-feedback-form/src/webparts/feedbackForm/loc/en-us.js b/samples/react-graph-feedback-form/src/webparts/feedbackForm/loc/en-us.js
new file mode 100644
index 000000000..4156e3c57
--- /dev/null
+++ b/samples/react-graph-feedback-form/src/webparts/feedbackForm/loc/en-us.js
@@ -0,0 +1,9 @@
+define([], function() {
+ return {
+ "PropertyPaneDescription": "Description",
+ "BasicGroupName": "Group Name",
+ "DescriptionFieldLabel": "Description Field",
+ "TargetEmailFieldLabel": "Target Email",
+ "SubjectFieldLabel": "Subject"
+ }
+});
diff --git a/samples/react-graph-feedback-form/src/webparts/feedbackForm/loc/mystrings.d.ts b/samples/react-graph-feedback-form/src/webparts/feedbackForm/loc/mystrings.d.ts
new file mode 100644
index 000000000..fbda57fa3
--- /dev/null
+++ b/samples/react-graph-feedback-form/src/webparts/feedbackForm/loc/mystrings.d.ts
@@ -0,0 +1,11 @@
+declare interface IFeedbackFormWebPartStrings {
+ PropertyPaneDescription: string;
+ BasicGroupName: string;
+ TargetEmailFieldLabel: string;
+ SubjectFieldLabel: string;
+}
+
+declare module 'FeedbackFormWebPartStrings' {
+ const strings: IFeedbackFormWebPartStrings;
+ export = strings;
+}
diff --git a/samples/react-graph-feedback-form/tsconfig.json b/samples/react-graph-feedback-form/tsconfig.json
new file mode 100644
index 000000000..131c5bb80
--- /dev/null
+++ b/samples/react-graph-feedback-form/tsconfig.json
@@ -0,0 +1,38 @@
+{
+ "extends": "./node_modules/@microsoft/rush-stack-compiler-2.9/includes/tsconfig-web.json",
+ "compilerOptions": {
+ "target": "es5",
+ "forceConsistentCasingInFileNames": true,
+ "module": "esnext",
+ "moduleResolution": "node",
+ "jsx": "react",
+ "declaration": true,
+ "sourceMap": true,
+ "experimentalDecorators": true,
+ "skipLibCheck": true,
+ "outDir": "lib",
+ "inlineSources": false,
+ "strictNullChecks": false,
+ "noUnusedLocals": false,
+ "typeRoots": [
+ "./node_modules/@types",
+ "./node_modules/@microsoft"
+ ],
+ "types": [
+ "es6-promise",
+ "webpack-env"
+ ],
+ "lib": [
+ "es5",
+ "dom",
+ "es2015.collection"
+ ]
+ },
+ "include": [
+ "src/**/*.ts"
+ ],
+ "exclude": [
+ "node_modules",
+ "lib"
+ ]
+}
diff --git a/samples/react-graph-feedback-form/tslint.json b/samples/react-graph-feedback-form/tslint.json
new file mode 100644
index 000000000..23fa2aa43
--- /dev/null
+++ b/samples/react-graph-feedback-form/tslint.json
@@ -0,0 +1,30 @@
+{
+ "extends": "@microsoft/sp-tslint-rules/base-tslint.json",
+ "rules": {
+ "class-name": false,
+ "export-name": false,
+ "forin": false,
+ "label-position": false,
+ "member-access": true,
+ "no-arg": false,
+ "no-console": false,
+ "no-construct": false,
+ "no-duplicate-variable": true,
+ "no-eval": false,
+ "no-function-expression": true,
+ "no-internal-module": true,
+ "no-shadowed-variable": true,
+ "no-switch-case-fall-through": true,
+ "no-unnecessary-semicolons": true,
+ "no-unused-expression": true,
+ "no-use-before-declare": true,
+ "no-with-statement": true,
+ "semicolon": true,
+ "trailing-comma": false,
+ "typedef": false,
+ "typedef-whitespace": false,
+ "use-named-parameter": true,
+ "variable-name": false,
+ "whitespace": false
+ }
+}
\ No newline at end of file