Files
n8n/packages/nodes-base/nodes/Microsoft/Teams/v2/actions/channel/create.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

84 lines
2.0 KiB
TypeScript

import type { INodeProperties, IExecuteFunctions, IDataObject } from 'n8n-workflow';
import { updateDisplayOptions } from '@utils/utilities';
import { teamRLC } from '../../descriptions';
import { microsoftApiRequest } from '../../transport';
const properties: INodeProperties[] = [
teamRLC,
{
displayName: 'New Channel Name',
name: 'name',
required: true,
type: 'string',
default: '',
placeholder: 'e.g. My New Channel',
description: 'The name of the new channel you want to create',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
default: {},
placeholder: 'Add option',
options: [
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'The description of the channel',
typeOptions: {
rows: 2,
},
},
{
displayName: 'Type',
name: 'type',
type: 'options',
options: [
{
name: 'Private',
value: 'private',
},
{
name: 'Standard',
value: 'standard',
},
],
default: 'standard',
description:
'Standard: Accessible to everyone on the team. Private: Accessible only to a specific group of people within the team.',
},
],
},
];
const displayOptions = {
show: {
resource: ['channel'],
operation: ['create'],
},
};
export const description = updateDisplayOptions(displayOptions, properties);
export async function execute(this: IExecuteFunctions, i: number) {
//https://docs.microsoft.com/en-us/graph/api/channel-post?view=graph-rest-beta&tabs=http
const teamId = this.getNodeParameter('teamId', i, '', { extractValue: true }) as string;
const name = this.getNodeParameter('name', i) as string;
const options = this.getNodeParameter('options', i);
const body: IDataObject = {
displayName: name,
};
if (options.description) {
body.description = options.description as string;
}
if (options.type) {
body.membershipType = options.type as string;
}
return await microsoftApiRequest.call(this, 'POST', `/v1.0/teams/${teamId}/channels`, body);
}