Merge pull request #1924 from Tanddant/main

This commit is contained in:
Hugo Bernier 2021-06-11 23:55:15 -04:00 committed by GitHub
commit a3c18850f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 12 deletions

View File

@ -34,6 +34,7 @@ react remote event receiver manager | [Dan Toft](https://github.com/Tanddant) ([
Version|Date|Comments
-------|----|--------
1.0.0|May 3, 2021|Initial release
1.1.0|June 9, 2021|Added support for synchronous and asynchronous event receivers
## Minimal Path to Awesome - please follow all the steps.
@ -53,9 +54,9 @@ Version|Date|Comments
**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
## Support
## Help
We do not support samples, but we do use GitHub to track issues and constantly want to improve these samples.
We do not support samples, but we this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues.
If you encounter any issues while using this sample, [create a new issue](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=bug-report.yml&sample=react-remote-event-receiver-manager&authors=@Tanddant&title=react-remote-event-receiver-manager%20-%20).

View File

@ -9,7 +9,7 @@
"A very simple web part that lets you add and delete remote event receivers to lists, the need came about due to remote event receivers not functioning properly when added with app only authentication and PnP.Powershell now only using that."
],
"creationDateTime": "2021-05-03",
"updateDateTime": "2021-05-03",
"updateDateTime": "2021-06-09",
"products": [
"SharePoint",
"Office"

View File

@ -3,7 +3,7 @@
"solution": {
"name": "sp-fx-remote-event-receiver-manager-client-side-solution",
"id": "ad113c85-22f8-4414-aa78-4cb897d8a285",
"version": "1.0.0.0",
"version": "1.1.0.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": true,
"isDomainIsolated": false,

View File

@ -1,6 +1,6 @@
{
"name": "sp-fx-remote-event-receiver-manager",
"version": "0.0.1",
"version": "1.1.0",
"private": true,
"main": "lib/index.js",
"engines": {

View File

@ -28,9 +28,6 @@ export default class RemoteEventReceiverManagerWebPart extends BaseClientSideWeb
protected onInit(): Promise<void> {
return super.onInit().then(_ => {
// other init code may be present
pnpSetup({
spfxContext: this.context
});

View File

@ -14,7 +14,7 @@ const SynchronizationOptions: IDropdownOption[] = [
{ key: 2, text: "Asynchronous" }
];
const EventTypeOptions: IDropdownOption[] = [
const EventTypeOptionsAsync: IDropdownOption[] = [
{ key: 10001, text: "ItemAdded" },
{ key: 10002, text: "ItemUpdated" },
{ key: 10003, text: "ItemDeleted" },
@ -25,9 +25,30 @@ const EventTypeOptions: IDropdownOption[] = [
{ key: 10008, text: "ItemAttachmentDeleted" },
{ key: 10009, text: "ItemFileMoved" },
{ key: 10010, text: "ItemFileConverted" },
{ key: 10011, text: "ItemVersionDeleted" },
];
const EventTypeOptionsSync: IDropdownOption[] = [
{ key: 1, text: "ItemAdding" },
{ key: 2, text: "ItemUpdating" },
{ key: 3, text: "ItemDeleteing" },
{ key: 4, text: "ItemCheckingIn" },
{ key: 5, text: "ItemCheckingOut" },
{ key: 6, text: "ItemUncheckingOut" },
{ key: 7, text: "ItemAttachmentAdding" },
{ key: 8, text: "ItemAttachmentDeleting" },
{ key: 9, text: "ItemFileMoveing" }
];
const getEventTypeOptions: (SynchronizationOption: number) => IDropdownOption[] = (SynchronizationOption: number) => {
switch (SynchronizationOption) {
case 1: return EventTypeOptionsSync;
case 2: return EventTypeOptionsAsync;
default:
return [...EventTypeOptionsAsync, ...EventTypeOptionsSync];
}
};
const NewEventReciever: IEventReceiver = {
ReceiverAssembly: "Microsoft.SharePoint, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c",
ReceiverClass: "Microsoft.SharePoint.Webhooks.SPWebhookItemEventReceiver",
@ -99,7 +120,6 @@ export default class RemoteEventReceiverManager extends React.Component<IRemoteE
this.loadEventReceivers(this.state.selectedList.Id);
}
private async deleteEventReceiver() {
this.setState({ isSaving: true });
await this.provider.deleteEventReceiver(this.state.selectedEventReceiver, this.state.selectedList.Id);
@ -107,6 +127,7 @@ export default class RemoteEventReceiverManager extends React.Component<IRemoteE
this.loadEventReceivers(this.state.selectedList.Id);
}
public render(): React.ReactElement<IRemoteEventReceiverManagerProps> {
const { selectedEventReceiver } = this.state;
@ -176,7 +197,7 @@ export default class RemoteEventReceiverManager extends React.Component<IRemoteE
<TextField disabled={selectedEventReceiver.ReceiverId != ""} label={"ReceiverName"} value={selectedEventReceiver.ReceiverName} onChange={(ev, val) => this.setState({ selectedEventReceiver: { ...selectedEventReceiver, ReceiverName: val } })} />
<TextField disabled={selectedEventReceiver.ReceiverId != ""} label={"SequenceNumber"} type={"number"} value={selectedEventReceiver.SequenceNumber + ""} onChange={(ev, val) => this.setState({ selectedEventReceiver: { ...selectedEventReceiver, SequenceNumber: val as any as number } })} />
<Dropdown disabled={selectedEventReceiver.ReceiverId != ""} label={"Synchronization"} selectedKey={selectedEventReceiver.Synchronization} onChange={(ev, val) => this.setState({ selectedEventReceiver: { ...selectedEventReceiver, Synchronization: val.key as number } })} options={SynchronizationOptions} />
<Dropdown disabled={selectedEventReceiver.ReceiverId != ""} label={"EventType"} selectedKey={selectedEventReceiver.EventType} onChange={(ev, val) => this.setState({ selectedEventReceiver: { ...selectedEventReceiver, EventType: val.key as number } })} options={EventTypeOptions} />
<Dropdown disabled={selectedEventReceiver.ReceiverId != ""} label={"EventType"} selectedKey={selectedEventReceiver.EventType} onChange={(ev, val) => this.setState({ selectedEventReceiver: { ...selectedEventReceiver, EventType: val.key as number } })} options={getEventTypeOptions(selectedEventReceiver.Synchronization)} />
<TextField disabled={selectedEventReceiver.ReceiverId != ""} label={"ReceiverUrl"} value={selectedEventReceiver.ReceiverUrl} onChange={(ev, val) => this.setState({ selectedEventReceiver: { ...selectedEventReceiver, ReceiverUrl: val } })} />
<DialogFooter>
<div style={{ display: "flex", placeContent: "flex-end" }}>