Files
n8n/packages/nodes-base/nodes/Microsoft/Teams/v2/actions/channel/deleteChannel.operation.ts
T
alighasami 3d5eaf9445
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
first commit
2026-03-17 16:22:57 +03:30

38 lines
1.2 KiB
TypeScript

import { type INodeProperties, type IExecuteFunctions, NodeOperationError } from 'n8n-workflow';
import { updateDisplayOptions } from '@utils/utilities';
import { channelRLC, teamRLC } from '../../descriptions';
import { microsoftApiRequest } from '../../transport';
const properties: INodeProperties[] = [teamRLC, channelRLC];
const displayOptions = {
show: {
resource: ['channel'],
operation: ['deleteChannel'],
},
};
export const description = updateDisplayOptions(displayOptions, properties);
export async function execute(this: IExecuteFunctions, i: number) {
//https://docs.microsoft.com/en-us/graph/api/channel-delete?view=graph-rest-beta&tabs=http
try {
const teamId = this.getNodeParameter('teamId', i, '', { extractValue: true }) as string;
const channelId = this.getNodeParameter('channelId', i, '', { extractValue: true }) as string;
await microsoftApiRequest.call(this, 'DELETE', `/v1.0/teams/${teamId}/channels/${channelId}`);
return { success: true };
} catch (error) {
throw new NodeOperationError(
this.getNode(),
"The channel you are trying to delete doesn't exist",
{
description: "Check that the 'Channel' parameter is correctly set",
},
);
}
}