first commit
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
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
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
|
||||
import { credentials } from '../credentials';
|
||||
|
||||
describe('Microsoft SharePoint Node', () => {
|
||||
const { baseUrl } = credentials.microsoftSharePointOAuth2Api;
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['create.workflow.json'],
|
||||
nock: {
|
||||
baseUrl,
|
||||
mocks: [
|
||||
{
|
||||
method: 'post',
|
||||
path: '/sites/site1/lists/list1/items',
|
||||
statusCode: 201,
|
||||
requestBody: {
|
||||
fields: {
|
||||
bool: true,
|
||||
Title: 'Title 1',
|
||||
choice: 'Choice 1',
|
||||
datetime: '2025-03-24T00:00:00',
|
||||
number: 1,
|
||||
currency: 1,
|
||||
LikesCount: 1,
|
||||
RatingCount: 1,
|
||||
AverageRating: 1,
|
||||
person: '1',
|
||||
lookup: '1',
|
||||
image:
|
||||
'{"type":"thumbnail","fileName":"file.jpg","nativeFile":{},"fieldName":"Picture","serverUrl":"https://mydomain.sharepoint.com","fieldId":"image","serverRelativeUrl":"/sites/site1/SiteAssets/Lists/list1/file.jpg","id":"image"}',
|
||||
},
|
||||
},
|
||||
responseBody: {
|
||||
'@odata.context':
|
||||
'https://mydomain.sharepoint.com/sites/site1/_api/v2.0/$metadata#listItems/$entity',
|
||||
'@odata.etag': '"625d681e-2ce3-4c2b-a490-7c8404a31427,1"',
|
||||
createdBy: {
|
||||
user: {
|
||||
displayName: 'John Doe',
|
||||
email: 'john@doe.onmicrosoft.com',
|
||||
id: '5f7afebb-121d-4664-882b-a09fe6584ce0',
|
||||
},
|
||||
},
|
||||
createdDateTime: '2025-03-25T20:07:23Z',
|
||||
eTag: '"625d681e-2ce3-4c2b-a490-7c8404a31427,1"',
|
||||
id: '1',
|
||||
lastModifiedBy: {
|
||||
application: {
|
||||
id: 'b9c26603-3c9b-4050-b848-27dfab0a52fa',
|
||||
displayName: 'sharepoint-n8n-test',
|
||||
},
|
||||
user: {
|
||||
displayName: 'John Doe',
|
||||
email: 'john@doe.onmicrosoft.com',
|
||||
id: '5f7afebb-121d-4664-882b-a09fe6584ce0',
|
||||
},
|
||||
},
|
||||
lastModifiedDateTime: '2025-03-25T20:07:23Z',
|
||||
parentReference: {
|
||||
id: '0ead9135-9622-4b6d-b319-6b8810a6dc60',
|
||||
listId: 'list1',
|
||||
siteId: 'site1',
|
||||
},
|
||||
webUrl: 'https://mydomain.sharepoint.com/sites/n8ntest10/Lists/test/41_.000',
|
||||
contentType: {
|
||||
id: '0x0100362657F7588C5C438072A77E0EF184F4000272C0D1046D984B8097B3C00D199EDE',
|
||||
name: 'Item',
|
||||
},
|
||||
'fields@odata.navigationLink': 'sites/site1/lists/list1/items/1/fields',
|
||||
fields: {
|
||||
'@odata.etag': '"625d681e-2ce3-4c2b-a490-7c8404a31427,1"',
|
||||
Title: 'Title 1',
|
||||
choice: 'Choice 1',
|
||||
datetime: '2025-03-24T07:00:00Z',
|
||||
number: 1,
|
||||
bool: true,
|
||||
currency: 1,
|
||||
image:
|
||||
'{"type":"thumbnail","fileName":"file.jpg","nativeFile":{},"fieldName":"Picture","serverUrl":"https://mydomain.sharepoint.com","fieldId":"image","serverRelativeUrl":"/sites/site1/SiteAssets/Lists/list1/file.jpg","id":"image"}',
|
||||
AverageRating: 1,
|
||||
ID: 1,
|
||||
ContentType: 'Item',
|
||||
Modified: '2025-03-25T20:07:23Z',
|
||||
Created: '2025-03-25T20:07:23Z',
|
||||
AuthorLookupId: '1',
|
||||
EditorLookupId: '1',
|
||||
_UIVersionString: '1.0',
|
||||
Attachments: false,
|
||||
Edit: '',
|
||||
LinkTitleNoMenu: 'Title 1',
|
||||
LinkTitle: 'Title 1',
|
||||
ItemChildCount: '0',
|
||||
FolderChildCount: '0',
|
||||
_ComplianceFlags: '',
|
||||
_ComplianceTag: '',
|
||||
_ComplianceTagWrittenTime: '',
|
||||
_ComplianceTagUserId: '',
|
||||
AppAuthorLookupId: '1',
|
||||
AppEditorLookupId: '1',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,291 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "37ab6212-d506-4b53-b63e-14b6a2a05907",
|
||||
"name": "When clicking ‘Test workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "item",
|
||||
"operation": "create",
|
||||
"site": {
|
||||
"__rl": true,
|
||||
"value": "site1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "site1"
|
||||
},
|
||||
"list": {
|
||||
"__rl": true,
|
||||
"value": "list1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "list1"
|
||||
},
|
||||
"columns": {
|
||||
"mappingMode": "defineBelow",
|
||||
"value": {
|
||||
"bool": true,
|
||||
"Title": "Title 1",
|
||||
"choice": "Choice 1",
|
||||
"datetime": "2025-03-24T00:00:00",
|
||||
"number": 1,
|
||||
"currency": 1,
|
||||
"LikesCount": 1,
|
||||
"RatingCount": 1,
|
||||
"AverageRating": 1,
|
||||
"person": "1",
|
||||
"lookup": "1",
|
||||
"image": "{\"type\":\"thumbnail\",\"fileName\":\"file.jpg\",\"nativeFile\":{},\"fieldName\":\"Picture\",\"serverUrl\":\"https://mydomain.sharepoint.com\",\"fieldId\":\"image\",\"serverRelativeUrl\":\"/sites/site1/SiteAssets/Lists/list1/file.jpg\",\"id\":\"image\"}"
|
||||
},
|
||||
"matchingColumns": [],
|
||||
"schema": [
|
||||
{
|
||||
"id": "Title",
|
||||
"canBeUsedToMatch": true,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"displayName": "Title",
|
||||
"readOnly": false,
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "choice",
|
||||
"canBeUsedToMatch": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"displayName": "choice",
|
||||
"readOnly": false,
|
||||
"required": false,
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"name": "Choice 1",
|
||||
"value": "Choice 1"
|
||||
},
|
||||
{
|
||||
"name": "Choice 2",
|
||||
"value": "Choice 2"
|
||||
},
|
||||
{
|
||||
"name": "Choice 3",
|
||||
"value": "Choice 3"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "datetime",
|
||||
"canBeUsedToMatch": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"displayName": "datetime",
|
||||
"readOnly": false,
|
||||
"required": false,
|
||||
"type": "dateTime"
|
||||
},
|
||||
{
|
||||
"id": "person",
|
||||
"canBeUsedToMatch": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"displayName": "person",
|
||||
"readOnly": false,
|
||||
"required": false,
|
||||
"type": "string",
|
||||
"removed": false
|
||||
},
|
||||
{
|
||||
"id": "number",
|
||||
"canBeUsedToMatch": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"displayName": "number",
|
||||
"readOnly": false,
|
||||
"required": false,
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"id": "bool",
|
||||
"canBeUsedToMatch": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"displayName": "bool",
|
||||
"readOnly": false,
|
||||
"required": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"id": "currency",
|
||||
"canBeUsedToMatch": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"displayName": "currency",
|
||||
"readOnly": false,
|
||||
"required": false,
|
||||
"type": "number",
|
||||
"removed": false
|
||||
},
|
||||
{
|
||||
"id": "image",
|
||||
"canBeUsedToMatch": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"displayName": "image",
|
||||
"readOnly": false,
|
||||
"required": false,
|
||||
"type": "object",
|
||||
"removed": false
|
||||
},
|
||||
{
|
||||
"id": "lookup",
|
||||
"canBeUsedToMatch": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"displayName": "lookup",
|
||||
"readOnly": false,
|
||||
"required": false,
|
||||
"type": "string",
|
||||
"removed": false
|
||||
},
|
||||
{
|
||||
"id": "AverageRating",
|
||||
"canBeUsedToMatch": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"displayName": "Rating (0-5)",
|
||||
"readOnly": false,
|
||||
"required": false,
|
||||
"type": "number",
|
||||
"removed": false
|
||||
},
|
||||
{
|
||||
"id": "RatingCount",
|
||||
"canBeUsedToMatch": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"displayName": "Number of Ratings",
|
||||
"readOnly": false,
|
||||
"required": false,
|
||||
"type": "number",
|
||||
"removed": false
|
||||
},
|
||||
{
|
||||
"id": "LikesCount",
|
||||
"canBeUsedToMatch": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"displayName": "Number of Likes",
|
||||
"readOnly": false,
|
||||
"required": false,
|
||||
"type": "number",
|
||||
"removed": false
|
||||
}
|
||||
],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": false
|
||||
},
|
||||
"requestOptions": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.microsoftSharePoint",
|
||||
"typeVersion": 1,
|
||||
"position": [220, 0],
|
||||
"id": "f9037af8-4f52-4f9f-b8ae-de860f890792",
|
||||
"name": "Microsoft SharePoint",
|
||||
"credentials": {
|
||||
"microsoftSharePointOAuth2Api": {
|
||||
"id": "cXXnMCWyk397M5qJ",
|
||||
"name": "Microsoft SharePoint account"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"When clicking ‘Test workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft SharePoint",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"pinData": {
|
||||
"Microsoft SharePoint": [
|
||||
{
|
||||
"json": {
|
||||
"@odata.context": "https://mydomain.sharepoint.com/sites/site1/_api/v2.0/$metadata#listItems/$entity",
|
||||
"@odata.etag": "\"625d681e-2ce3-4c2b-a490-7c8404a31427,1\"",
|
||||
"createdBy": {
|
||||
"user": {
|
||||
"displayName": "John Doe",
|
||||
"email": "john@doe.onmicrosoft.com",
|
||||
"id": "5f7afebb-121d-4664-882b-a09fe6584ce0"
|
||||
}
|
||||
},
|
||||
"createdDateTime": "2025-03-25T20:07:23Z",
|
||||
"eTag": "\"625d681e-2ce3-4c2b-a490-7c8404a31427,1\"",
|
||||
"id": "1",
|
||||
"lastModifiedBy": {
|
||||
"application": {
|
||||
"id": "b9c26603-3c9b-4050-b848-27dfab0a52fa",
|
||||
"displayName": "sharepoint-n8n-test"
|
||||
},
|
||||
"user": {
|
||||
"displayName": "John Doe",
|
||||
"email": "john@doe.onmicrosoft.com",
|
||||
"id": "5f7afebb-121d-4664-882b-a09fe6584ce0"
|
||||
}
|
||||
},
|
||||
"lastModifiedDateTime": "2025-03-25T20:07:23Z",
|
||||
"parentReference": {
|
||||
"id": "0ead9135-9622-4b6d-b319-6b8810a6dc60",
|
||||
"listId": "list1",
|
||||
"siteId": "site1"
|
||||
},
|
||||
"webUrl": "https://mydomain.sharepoint.com/sites/n8ntest10/Lists/test/41_.000",
|
||||
"contentType": {
|
||||
"id": "0x0100362657F7588C5C438072A77E0EF184F4000272C0D1046D984B8097B3C00D199EDE",
|
||||
"name": "Item"
|
||||
},
|
||||
"fields@odata.navigationLink": "sites/site1/lists/list1/items/1/fields",
|
||||
"fields": {
|
||||
"@odata.etag": "\"625d681e-2ce3-4c2b-a490-7c8404a31427,1\"",
|
||||
"Title": "Title 1",
|
||||
"choice": "Choice 1",
|
||||
"datetime": "2025-03-24T07:00:00Z",
|
||||
"number": 1,
|
||||
"bool": true,
|
||||
"currency": 1,
|
||||
"image": "{\"type\":\"thumbnail\",\"fileName\":\"file.jpg\",\"nativeFile\":{},\"fieldName\":\"Picture\",\"serverUrl\":\"https://mydomain.sharepoint.com\",\"fieldId\":\"image\",\"serverRelativeUrl\":\"/sites/site1/SiteAssets/Lists/list1/file.jpg\",\"id\":\"image\"}",
|
||||
"AverageRating": 1,
|
||||
"ID": 1,
|
||||
"ContentType": "Item",
|
||||
"Modified": "2025-03-25T20:07:23Z",
|
||||
"Created": "2025-03-25T20:07:23Z",
|
||||
"AuthorLookupId": "1",
|
||||
"EditorLookupId": "1",
|
||||
"_UIVersionString": "1.0",
|
||||
"Attachments": false,
|
||||
"Edit": "",
|
||||
"LinkTitleNoMenu": "Title 1",
|
||||
"LinkTitle": "Title 1",
|
||||
"ItemChildCount": "0",
|
||||
"FolderChildCount": "0",
|
||||
"_ComplianceFlags": "",
|
||||
"_ComplianceTag": "",
|
||||
"_ComplianceTagWrittenTime": "",
|
||||
"_ComplianceTagUserId": "",
|
||||
"AppAuthorLookupId": "1",
|
||||
"AppEditorLookupId": "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
|
||||
import { credentials } from '../credentials';
|
||||
|
||||
describe('Microsoft SharePoint Node', () => {
|
||||
const { baseUrl } = credentials.microsoftSharePointOAuth2Api;
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['delete.workflow.json'],
|
||||
nock: {
|
||||
baseUrl,
|
||||
mocks: [
|
||||
{
|
||||
method: 'delete',
|
||||
path: '/sites/site1/lists/list1/items/item1',
|
||||
statusCode: 204,
|
||||
responseBody: {},
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "d8d29d0a-bb31-4094-a252-8008932f5425",
|
||||
"name": "When clicking ‘Test workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "item",
|
||||
"operation": "delete",
|
||||
"site": {
|
||||
"__rl": true,
|
||||
"value": "site1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "site1"
|
||||
},
|
||||
"list": {
|
||||
"__rl": true,
|
||||
"value": "list1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "list1"
|
||||
},
|
||||
"item": {
|
||||
"__rl": true,
|
||||
"value": "item1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "item1"
|
||||
},
|
||||
"requestOptions": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.microsoftSharePoint",
|
||||
"typeVersion": 1,
|
||||
"position": [200, 0],
|
||||
"id": "0e19be10-9d94-4654-89e9-432daa8102cb",
|
||||
"name": "Microsoft SharePoint",
|
||||
"credentials": {
|
||||
"microsoftSharePointOAuth2Api": {
|
||||
"id": "cXXnMCWyk397M5qJ",
|
||||
"name": "Microsoft SharePoint account"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"When clicking ‘Test workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft SharePoint",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"pinData": {
|
||||
"Microsoft SharePoint": [
|
||||
{
|
||||
"json": {
|
||||
"deleted": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
|
||||
import { credentials } from '../credentials';
|
||||
|
||||
describe('Microsoft SharePoint Node', () => {
|
||||
const { baseUrl } = credentials.microsoftSharePointOAuth2Api;
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['get.workflow.json'],
|
||||
nock: {
|
||||
baseUrl,
|
||||
mocks: [
|
||||
{
|
||||
method: 'get',
|
||||
path: '/sites/site1/lists/list1/items/item1?%24select=id%2CcreatedDateTime%2ClastModifiedDateTime%2CwebUrl&%24expand=fields%28select%3DTitle%29',
|
||||
statusCode: 200,
|
||||
responseBody: {
|
||||
'@odata.context':
|
||||
'https://mydomain.sharepoint.com/sites/site1/_api/v2.0/$metadata#listItems/$entity',
|
||||
'@odata.etag': '"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1"',
|
||||
createdBy: {
|
||||
user: {
|
||||
displayName: 'John Doe',
|
||||
email: 'john@doe.onmicrosoft.com',
|
||||
id: '5f7afebb-121d-4664-882b-a09fe6584ce0',
|
||||
},
|
||||
},
|
||||
createdDateTime: '2025-03-12T22:18:18Z',
|
||||
eTag: '"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1"',
|
||||
id: 'item1',
|
||||
lastModifiedBy: {
|
||||
application: {
|
||||
id: 'b9c26603-3c9b-4050-b848-27dfab0a52fa',
|
||||
displayName: 'sharepoint-n8n-test',
|
||||
},
|
||||
user: {
|
||||
displayName: 'John Doe',
|
||||
email: 'john@doe.onmicrosoft.com',
|
||||
id: '5f7afebb-121d-4664-882b-a09fe6584ce0',
|
||||
},
|
||||
},
|
||||
lastModifiedDateTime: '2025-03-12T22:18:18Z',
|
||||
parentReference: {
|
||||
id: '84070a73-ea24-463c-8eb2-0e9afa11c63f',
|
||||
listId: 'list1',
|
||||
siteId: 'site1',
|
||||
},
|
||||
webUrl: 'https://mydomain.sharepoint.com/sites/site1/Lists/name%20list/1_.000',
|
||||
contentType: {
|
||||
id: '0x010010D603DC4CF2DF4BB8A2D75DCB4BB1B30037A4993FB4DEB0439C3DC6DEC95A9DF8',
|
||||
name: 'Item',
|
||||
},
|
||||
'fields@odata.navigationLink': 'sites/site1/lists/list1/items/item1/fields',
|
||||
fields: {
|
||||
'@odata.etag': '"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1"',
|
||||
Title: 'Item 1',
|
||||
ID: 'item1',
|
||||
ContentType: 'Item',
|
||||
Modified: '2025-03-12T22:18:18Z',
|
||||
Created: '2025-03-12T22:18:18Z',
|
||||
AuthorLookupId: '7',
|
||||
EditorLookupId: '7',
|
||||
_UIVersionString: '1.0',
|
||||
Attachments: false,
|
||||
Edit: '',
|
||||
LinkTitleNoMenu: 'Item 1',
|
||||
LinkTitle: 'Item 1',
|
||||
ItemChildCount: '0',
|
||||
FolderChildCount: '0',
|
||||
_ComplianceFlags: '',
|
||||
_ComplianceTag: '',
|
||||
_ComplianceTagWrittenTime: '',
|
||||
_ComplianceTagUserId: '',
|
||||
AppAuthorLookupId: '5',
|
||||
AppEditorLookupId: '5',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,123 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "d8d29d0a-bb31-4094-a252-8008932f5425",
|
||||
"name": "When clicking ‘Test workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "item",
|
||||
"operation": "get",
|
||||
"site": {
|
||||
"__rl": true,
|
||||
"value": "site1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "site1"
|
||||
},
|
||||
"list": {
|
||||
"__rl": true,
|
||||
"value": "list1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "list1"
|
||||
},
|
||||
"item": {
|
||||
"__rl": true,
|
||||
"value": "item1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "item1"
|
||||
},
|
||||
"requestOptions": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.microsoftSharePoint",
|
||||
"typeVersion": 1,
|
||||
"position": [200, 0],
|
||||
"id": "0e19be10-9d94-4654-89e9-432daa8102cb",
|
||||
"name": "Microsoft SharePoint",
|
||||
"credentials": {
|
||||
"microsoftSharePointOAuth2Api": {
|
||||
"id": "cXXnMCWyk397M5qJ",
|
||||
"name": "Microsoft SharePoint account"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"When clicking ‘Test workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft SharePoint",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"pinData": {
|
||||
"Microsoft SharePoint": [
|
||||
{
|
||||
"json": {
|
||||
"createdBy": {
|
||||
"user": {
|
||||
"displayName": "John Doe",
|
||||
"email": "john@doe.onmicrosoft.com",
|
||||
"id": "5f7afebb-121d-4664-882b-a09fe6584ce0"
|
||||
}
|
||||
},
|
||||
"createdDateTime": "2025-03-12T22:18:18Z",
|
||||
"eTag": "\"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1\"",
|
||||
"id": "item1",
|
||||
"lastModifiedBy": {
|
||||
"application": {
|
||||
"id": "b9c26603-3c9b-4050-b848-27dfab0a52fa",
|
||||
"displayName": "sharepoint-n8n-test"
|
||||
},
|
||||
"user": {
|
||||
"displayName": "John Doe",
|
||||
"email": "john@doe.onmicrosoft.com",
|
||||
"id": "5f7afebb-121d-4664-882b-a09fe6584ce0"
|
||||
}
|
||||
},
|
||||
"lastModifiedDateTime": "2025-03-12T22:18:18Z",
|
||||
"parentReference": {
|
||||
"id": "84070a73-ea24-463c-8eb2-0e9afa11c63f",
|
||||
"listId": "list1",
|
||||
"siteId": "site1"
|
||||
},
|
||||
"webUrl": "https://mydomain.sharepoint.com/sites/site1/Lists/name%20list/1_.000",
|
||||
"contentType": {
|
||||
"id": "0x010010D603DC4CF2DF4BB8A2D75DCB4BB1B30037A4993FB4DEB0439C3DC6DEC95A9DF8",
|
||||
"name": "Item"
|
||||
},
|
||||
"fields": {
|
||||
"Title": "Item 1",
|
||||
"ID": "item1",
|
||||
"ContentType": "Item",
|
||||
"Modified": "2025-03-12T22:18:18Z",
|
||||
"Created": "2025-03-12T22:18:18Z",
|
||||
"AuthorLookupId": "7",
|
||||
"EditorLookupId": "7",
|
||||
"_UIVersionString": "1.0",
|
||||
"Attachments": false,
|
||||
"Edit": "",
|
||||
"LinkTitleNoMenu": "Item 1",
|
||||
"LinkTitle": "Item 1",
|
||||
"ItemChildCount": "0",
|
||||
"FolderChildCount": "0",
|
||||
"_ComplianceFlags": "",
|
||||
"_ComplianceTag": "",
|
||||
"_ComplianceTagWrittenTime": "",
|
||||
"_ComplianceTagUserId": "",
|
||||
"AppAuthorLookupId": "5",
|
||||
"AppEditorLookupId": "5"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
|
||||
import { credentials } from '../credentials';
|
||||
|
||||
describe('Microsoft SharePoint Node', () => {
|
||||
const { baseUrl } = credentials.microsoftSharePointOAuth2Api;
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['getAll.workflow.json'],
|
||||
nock: {
|
||||
baseUrl,
|
||||
mocks: [
|
||||
{
|
||||
method: 'get',
|
||||
path: '/sites/site1/lists/list1/items?%24select%5B0%5D=contentType&%24select%5B1%5D=createdDateTime&%24select%5B2%5D=createdBy&%24select%5B3%5D=fields&%24select%5B4%5D=id&%24select%5B5%5D=lastModifiedDateTime&%24select%5B6%5D=lastModifiedBy&%24select%5B7%5D=parentReference&%24select%5B8%5D=webUrl',
|
||||
statusCode: 200,
|
||||
responseBody: {
|
||||
value: [
|
||||
{
|
||||
'@odata.context':
|
||||
'https://mydomain.sharepoint.com/sites/site1/_api/v2.0/$metadata#listItems/$entity',
|
||||
'@odata.etag': '"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1"',
|
||||
createdBy: {
|
||||
user: {
|
||||
displayName: 'John Doe',
|
||||
email: 'john@doe.onmicrosoft.com',
|
||||
id: '5f7afebb-121d-4664-882b-a09fe6584ce0',
|
||||
},
|
||||
},
|
||||
createdDateTime: '2025-03-12T22:18:18Z',
|
||||
eTag: '"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1"',
|
||||
id: 'item1',
|
||||
lastModifiedBy: {
|
||||
application: {
|
||||
id: 'b9c26603-3c9b-4050-b848-27dfab0a52fa',
|
||||
displayName: 'sharepoint-n8n-test',
|
||||
},
|
||||
user: {
|
||||
displayName: 'John Doe',
|
||||
email: 'john@doe.onmicrosoft.com',
|
||||
id: '5f7afebb-121d-4664-882b-a09fe6584ce0',
|
||||
},
|
||||
},
|
||||
lastModifiedDateTime: '2025-03-12T22:18:18Z',
|
||||
parentReference: {
|
||||
id: '84070a73-ea24-463c-8eb2-0e9afa11c63f',
|
||||
listId: 'list1',
|
||||
siteId: 'site1',
|
||||
},
|
||||
webUrl: 'https://mydomain.sharepoint.com/sites/site1/Lists/name%20list/1_.000',
|
||||
contentType: {
|
||||
id: '0x010010D603DC4CF2DF4BB8A2D75DCB4BB1B30037A4993FB4DEB0439C3DC6DEC95A9DF8',
|
||||
name: 'Item',
|
||||
},
|
||||
'fields@odata.navigationLink': 'sites/site1/lists/list1/items/item1/fields',
|
||||
fields: {
|
||||
'@odata.etag': '"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1"',
|
||||
Title: 'Item 1',
|
||||
ID: 'item1',
|
||||
ContentType: 'Item',
|
||||
Modified: '2025-03-12T22:18:18Z',
|
||||
Created: '2025-03-12T22:18:18Z',
|
||||
AuthorLookupId: '7',
|
||||
EditorLookupId: '7',
|
||||
_UIVersionString: '1.0',
|
||||
Attachments: false,
|
||||
Edit: '',
|
||||
LinkTitleNoMenu: 'Item 1',
|
||||
LinkTitle: 'Item 1',
|
||||
ItemChildCount: '0',
|
||||
FolderChildCount: '0',
|
||||
_ComplianceFlags: '',
|
||||
_ComplianceTag: '',
|
||||
_ComplianceTagWrittenTime: '',
|
||||
_ComplianceTagUserId: '',
|
||||
AppAuthorLookupId: '5',
|
||||
AppEditorLookupId: '5',
|
||||
},
|
||||
},
|
||||
],
|
||||
'@odata.nextLink':
|
||||
'https://mydomain.sharepoint.com/_api/v2.0/sites(%27site1%27)/lists(%27list1%27)/items?%24skiptoken=UGFnZWQ9VFJVRSZwX0lEPTE&%24top=1&%24expand=fields&%24select%5b0%5d=contentType&%24select%5b1%5d=createdDateTime&%24select%5b2%5d=createdBy&%24select%5b3%5d=fields&%24select%5b4%5d=id&%24select%5b5%5d=lastModifiedDateTime&%24select%5b6%5d=lastModifiedBy&%24select%5b7%5d=parentReference&%24select%5b8%5d=webUrl',
|
||||
},
|
||||
},
|
||||
{
|
||||
method: 'get',
|
||||
path: '/sites(%27site1%27)/lists(%27list1%27)/items?%24skiptoken=UGFnZWQ9VFJVRSZwX0lEPTE&%24top=1&%24expand=fields&%24select%5b0%5d=contentType&%24select%5b1%5d=createdDateTime&%24select%5b2%5d=createdBy&%24select%5b3%5d=fields&%24select%5b4%5d=id&%24select%5b5%5d=lastModifiedDateTime&%24select%5b6%5d=lastModifiedBy&%24select%5b7%5d=parentReference&%24select%5b8%5d=webUrl',
|
||||
statusCode: 200,
|
||||
responseBody: {
|
||||
value: [
|
||||
{
|
||||
'@odata.context':
|
||||
'https://mydomain.sharepoint.com/sites/site1/_api/v2.0/$metadata#listItems/$entity',
|
||||
'@odata.etag': '"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1"',
|
||||
createdBy: {
|
||||
user: {
|
||||
displayName: 'John Doe',
|
||||
email: 'john@doe.onmicrosoft.com',
|
||||
id: '5f7afebb-121d-4664-882b-a09fe6584ce0',
|
||||
},
|
||||
},
|
||||
createdDateTime: '2025-03-12T22:18:18Z',
|
||||
eTag: '"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1"',
|
||||
id: 'item2',
|
||||
lastModifiedBy: {
|
||||
application: {
|
||||
id: 'b9c26603-3c9b-4050-b848-27dfab0a52fa',
|
||||
displayName: 'sharepoint-n8n-test',
|
||||
},
|
||||
user: {
|
||||
displayName: 'John Doe',
|
||||
email: 'john@doe.onmicrosoft.com',
|
||||
id: '5f7afebb-121d-4664-882b-a09fe6584ce0',
|
||||
},
|
||||
},
|
||||
lastModifiedDateTime: '2025-03-12T22:18:18Z',
|
||||
parentReference: {
|
||||
id: '84070a73-ea24-463c-8eb2-0e9afa11c63f',
|
||||
listId: 'list1',
|
||||
siteId: 'site1',
|
||||
},
|
||||
webUrl: 'https://mydomain.sharepoint.com/sites/site1/Lists/name%20list/1_.000',
|
||||
contentType: {
|
||||
id: '0x010010D603DC4CF2DF4BB8A2D75DCB4BB1B30037A4993FB4DEB0439C3DC6DEC95A9DF8',
|
||||
name: 'Item',
|
||||
},
|
||||
'fields@odata.navigationLink': 'sites/site1/lists/list1/items/item1/fields',
|
||||
fields: {
|
||||
'@odata.etag': '"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1"',
|
||||
Title: 'Item 2',
|
||||
ID: 'item2',
|
||||
ContentType: 'Item',
|
||||
Modified: '2025-03-12T22:18:18Z',
|
||||
Created: '2025-03-12T22:18:18Z',
|
||||
AuthorLookupId: '7',
|
||||
EditorLookupId: '7',
|
||||
_UIVersionString: '1.0',
|
||||
Attachments: false,
|
||||
Edit: '',
|
||||
LinkTitleNoMenu: 'Item 2',
|
||||
LinkTitle: 'Item 2',
|
||||
ItemChildCount: '0',
|
||||
FolderChildCount: '0',
|
||||
_ComplianceFlags: '',
|
||||
_ComplianceTag: '',
|
||||
_ComplianceTagWrittenTime: '',
|
||||
_ComplianceTagUserId: '',
|
||||
AppAuthorLookupId: '5',
|
||||
AppEditorLookupId: '5',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,198 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "d8d29d0a-bb31-4094-a252-8008932f5425",
|
||||
"name": "When clicking ‘Test workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "item",
|
||||
"site": {
|
||||
"__rl": true,
|
||||
"value": "site1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "site1"
|
||||
},
|
||||
"list": {
|
||||
"__rl": true,
|
||||
"value": "list1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "list1"
|
||||
},
|
||||
"filter": "fields/Title eq 'item1'",
|
||||
"returnAll": true,
|
||||
"options": {
|
||||
"fields": [
|
||||
"contentType",
|
||||
"createdDateTime",
|
||||
"createdBy",
|
||||
"fields",
|
||||
"id",
|
||||
"lastModifiedDateTime",
|
||||
"lastModifiedBy",
|
||||
"parentReference",
|
||||
"webUrl"
|
||||
]
|
||||
},
|
||||
"simplify": false,
|
||||
"requestOptions": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.microsoftSharePoint",
|
||||
"typeVersion": 1,
|
||||
"position": [200, 0],
|
||||
"id": "0e19be10-9d94-4654-89e9-432daa8102cb",
|
||||
"name": "Microsoft SharePoint",
|
||||
"credentials": {
|
||||
"microsoftSharePointOAuth2Api": {
|
||||
"id": "cXXnMCWyk397M5qJ",
|
||||
"name": "Microsoft SharePoint account"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"When clicking ‘Test workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft SharePoint",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"pinData": {
|
||||
"Microsoft SharePoint": [
|
||||
{
|
||||
"json": {
|
||||
"@odata.context": "https://mydomain.sharepoint.com/sites/site1/_api/v2.0/$metadata#listItems/$entity",
|
||||
"@odata.etag": "\"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1\"",
|
||||
"createdBy": {
|
||||
"user": {
|
||||
"displayName": "John Doe",
|
||||
"email": "john@doe.onmicrosoft.com",
|
||||
"id": "5f7afebb-121d-4664-882b-a09fe6584ce0"
|
||||
}
|
||||
},
|
||||
"createdDateTime": "2025-03-12T22:18:18Z",
|
||||
"eTag": "\"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1\"",
|
||||
"id": "item1",
|
||||
"lastModifiedBy": {
|
||||
"application": {
|
||||
"id": "b9c26603-3c9b-4050-b848-27dfab0a52fa",
|
||||
"displayName": "sharepoint-n8n-test"
|
||||
},
|
||||
"user": {
|
||||
"displayName": "John Doe",
|
||||
"email": "john@doe.onmicrosoft.com",
|
||||
"id": "5f7afebb-121d-4664-882b-a09fe6584ce0"
|
||||
}
|
||||
},
|
||||
"lastModifiedDateTime": "2025-03-12T22:18:18Z",
|
||||
"parentReference": {
|
||||
"id": "84070a73-ea24-463c-8eb2-0e9afa11c63f",
|
||||
"listId": "list1",
|
||||
"siteId": "site1"
|
||||
},
|
||||
"webUrl": "https://mydomain.sharepoint.com/sites/site1/Lists/name%20list/1_.000",
|
||||
"contentType": {
|
||||
"id": "0x010010D603DC4CF2DF4BB8A2D75DCB4BB1B30037A4993FB4DEB0439C3DC6DEC95A9DF8",
|
||||
"name": "Item"
|
||||
},
|
||||
"fields@odata.navigationLink": "sites/site1/lists/list1/items/item1/fields",
|
||||
"fields": {
|
||||
"@odata.etag": "\"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1\"",
|
||||
"Title": "Item 1",
|
||||
"ID": "item1",
|
||||
"ContentType": "Item",
|
||||
"Modified": "2025-03-12T22:18:18Z",
|
||||
"Created": "2025-03-12T22:18:18Z",
|
||||
"AuthorLookupId": "7",
|
||||
"EditorLookupId": "7",
|
||||
"_UIVersionString": "1.0",
|
||||
"Attachments": false,
|
||||
"Edit": "",
|
||||
"LinkTitleNoMenu": "Item 1",
|
||||
"LinkTitle": "Item 1",
|
||||
"ItemChildCount": "0",
|
||||
"FolderChildCount": "0",
|
||||
"_ComplianceFlags": "",
|
||||
"_ComplianceTag": "",
|
||||
"_ComplianceTagWrittenTime": "",
|
||||
"_ComplianceTagUserId": "",
|
||||
"AppAuthorLookupId": "5",
|
||||
"AppEditorLookupId": "5"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"@odata.context": "https://mydomain.sharepoint.com/sites/site1/_api/v2.0/$metadata#listItems/$entity",
|
||||
"@odata.etag": "\"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1\"",
|
||||
"createdBy": {
|
||||
"user": {
|
||||
"displayName": "John Doe",
|
||||
"email": "john@doe.onmicrosoft.com",
|
||||
"id": "5f7afebb-121d-4664-882b-a09fe6584ce0"
|
||||
}
|
||||
},
|
||||
"createdDateTime": "2025-03-12T22:18:18Z",
|
||||
"eTag": "\"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1\"",
|
||||
"id": "item2",
|
||||
"lastModifiedBy": {
|
||||
"application": {
|
||||
"id": "b9c26603-3c9b-4050-b848-27dfab0a52fa",
|
||||
"displayName": "sharepoint-n8n-test"
|
||||
},
|
||||
"user": {
|
||||
"displayName": "John Doe",
|
||||
"email": "john@doe.onmicrosoft.com",
|
||||
"id": "5f7afebb-121d-4664-882b-a09fe6584ce0"
|
||||
}
|
||||
},
|
||||
"lastModifiedDateTime": "2025-03-12T22:18:18Z",
|
||||
"parentReference": {
|
||||
"id": "84070a73-ea24-463c-8eb2-0e9afa11c63f",
|
||||
"listId": "list1",
|
||||
"siteId": "site1"
|
||||
},
|
||||
"webUrl": "https://mydomain.sharepoint.com/sites/site1/Lists/name%20list/1_.000",
|
||||
"contentType": {
|
||||
"id": "0x010010D603DC4CF2DF4BB8A2D75DCB4BB1B30037A4993FB4DEB0439C3DC6DEC95A9DF8",
|
||||
"name": "Item"
|
||||
},
|
||||
"fields@odata.navigationLink": "sites/site1/lists/list1/items/item1/fields",
|
||||
"fields": {
|
||||
"@odata.etag": "\"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1\"",
|
||||
"Title": "Item 2",
|
||||
"ID": "item2",
|
||||
"ContentType": "Item",
|
||||
"Modified": "2025-03-12T22:18:18Z",
|
||||
"Created": "2025-03-12T22:18:18Z",
|
||||
"AuthorLookupId": "7",
|
||||
"EditorLookupId": "7",
|
||||
"_UIVersionString": "1.0",
|
||||
"Attachments": false,
|
||||
"Edit": "",
|
||||
"LinkTitleNoMenu": "Item 2",
|
||||
"LinkTitle": "Item 2",
|
||||
"ItemChildCount": "0",
|
||||
"FolderChildCount": "0",
|
||||
"_ComplianceFlags": "",
|
||||
"_ComplianceTag": "",
|
||||
"_ComplianceTagWrittenTime": "",
|
||||
"_ComplianceTagUserId": "",
|
||||
"AppAuthorLookupId": "5",
|
||||
"AppEditorLookupId": "5"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
|
||||
import { credentials } from '../credentials';
|
||||
|
||||
describe('Microsoft SharePoint Node', () => {
|
||||
const { baseUrl } = credentials.microsoftSharePointOAuth2Api;
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['getAllLimitSimplify.workflow.json'],
|
||||
nock: {
|
||||
baseUrl,
|
||||
mocks: [
|
||||
{
|
||||
method: 'get',
|
||||
path: '/sites/site1/lists/list1/items?%24top=2&%24select=id%2CcreatedDateTime%2ClastModifiedDateTime%2CwebUrl&%24expand=fields%28select%3DTitle%29',
|
||||
statusCode: 200,
|
||||
responseBody: {
|
||||
value: [
|
||||
{
|
||||
'@odata.context':
|
||||
'https://mydomain.sharepoint.com/sites/site1/_api/v2.0/$metadata#listItems/$entity',
|
||||
'@odata.etag': '"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1"',
|
||||
createdDateTime: '2025-03-12T22:18:18Z',
|
||||
id: 'item1',
|
||||
lastModifiedDateTime: '2025-03-12T22:18:18Z',
|
||||
webUrl: 'https://mydomain.sharepoint.com/sites/site1/Lists/name%20list/1_.000',
|
||||
'fields@odata.navigationLink': 'sites/site1/lists/list1/items/item1/fields',
|
||||
fields: {
|
||||
'@odata.etag': '"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1"',
|
||||
Title: 'Item 1',
|
||||
},
|
||||
},
|
||||
{
|
||||
'@odata.context':
|
||||
'https://mydomain.sharepoint.com/sites/site1/_api/v2.0/$metadata#listItems/$entity',
|
||||
'@odata.etag': '"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1"',
|
||||
createdDateTime: '2025-03-12T22:18:18Z',
|
||||
id: 'item2',
|
||||
lastModifiedDateTime: '2025-03-12T22:18:18Z',
|
||||
webUrl: 'https://mydomain.sharepoint.com/sites/site1/Lists/name%20list/1_.000',
|
||||
'fields@odata.navigationLink': 'sites/site1/lists/list1/items/item1/fields',
|
||||
fields: {
|
||||
'@odata.etag': '"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1"',
|
||||
Title: 'Item 2',
|
||||
},
|
||||
},
|
||||
],
|
||||
'@odata.nextLink':
|
||||
'https://mydomain.sharepoint.com/_api/v2.0/sites(%27site1%27)/lists(%27list1%27)/items?%24skiptoken=UGFnZWQ9VFJVRSZwX0lEPTE&%24top=1&%24expand=fields&%24select%5b0%5d=contentType&%24select%5b1%5d=createdDateTime&%24select%5b2%5d=createdBy&%24select%5b3%5d=fields&%24select%5b4%5d=id&%24select%5b5%5d=lastModifiedDateTime&%24select%5b6%5d=lastModifiedBy&%24select%5b7%5d=parentReference&%24select%5b8%5d=webUrl',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
});
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "d8d29d0a-bb31-4094-a252-8008932f5425",
|
||||
"name": "When clicking ‘Test workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "item",
|
||||
"site": {
|
||||
"__rl": true,
|
||||
"value": "site1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "site1"
|
||||
},
|
||||
"list": {
|
||||
"__rl": true,
|
||||
"value": "list1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "list1"
|
||||
},
|
||||
"limit": 2,
|
||||
"options": {},
|
||||
"requestOptions": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.microsoftSharePoint",
|
||||
"typeVersion": 1,
|
||||
"position": [200, 0],
|
||||
"id": "0e19be10-9d94-4654-89e9-432daa8102cb",
|
||||
"name": "Microsoft SharePoint",
|
||||
"credentials": {
|
||||
"microsoftSharePointOAuth2Api": {
|
||||
"id": "cXXnMCWyk397M5qJ",
|
||||
"name": "Microsoft SharePoint account"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"When clicking ‘Test workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft SharePoint",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"pinData": {
|
||||
"Microsoft SharePoint": [
|
||||
{
|
||||
"json": {
|
||||
"createdDateTime": "2025-03-12T22:18:18Z",
|
||||
"id": "item1",
|
||||
"lastModifiedDateTime": "2025-03-12T22:18:18Z",
|
||||
"webUrl": "https://mydomain.sharepoint.com/sites/site1/Lists/name%20list/1_.000",
|
||||
"fields": {
|
||||
"Title": "Item 1"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"createdDateTime": "2025-03-12T22:18:18Z",
|
||||
"id": "item2",
|
||||
"lastModifiedDateTime": "2025-03-12T22:18:18Z",
|
||||
"webUrl": "https://mydomain.sharepoint.com/sites/site1/Lists/name%20list/1_.000",
|
||||
"fields": {
|
||||
"Title": "Item 2"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
import { CredentialsHelper } from '@nodes-testing/credentials-helper';
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
import { credentials } from '../credentials';
|
||||
|
||||
describe('Microsoft SharePoint Node - Token Refresh', () => {
|
||||
const { baseUrl } = credentials.microsoftSharePointOAuth2Api;
|
||||
const tokenRefreshUrl = 'https://login.microsoftonline.com';
|
||||
const itemPath =
|
||||
'/sites/site1/lists/list1/items/item1?%24select=id%2CcreatedDateTime%2ClastModifiedDateTime%2CwebUrl&%24expand=fields%28select%3DTitle%29';
|
||||
|
||||
let updateCredentialsSpy: jest.SpyInstance;
|
||||
|
||||
beforeAll(() => {
|
||||
// Mock the credential helper to return oAuth2Api as parent type
|
||||
jest.spyOn(CredentialsHelper.prototype, 'getParentTypes').mockReturnValue(['oAuth2Api']);
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
// Spy on the updateCredentialsOauthTokenData to verify token refresh
|
||||
updateCredentialsSpy = jest
|
||||
.spyOn(CredentialsHelper.prototype, 'updateCredentialsOauthTokenData')
|
||||
.mockResolvedValue();
|
||||
|
||||
// Set up mocks for token refresh scenario
|
||||
// First request: Return 401 Unauthorized (expired token)
|
||||
nock(baseUrl)
|
||||
.get(itemPath)
|
||||
.matchHeader('Authorization', 'Bearer ACCESSTOKEN')
|
||||
.reply(401, {
|
||||
error: {
|
||||
code: 'InvalidAuthenticationToken',
|
||||
message: 'Access token has expired.',
|
||||
},
|
||||
});
|
||||
|
||||
// Token refresh request
|
||||
nock(tokenRefreshUrl).post('/common/oauth2/v2.0/token').reply(200, {
|
||||
token_type: 'Bearer',
|
||||
scope:
|
||||
'https://mydomain.sharepoint.com/Sites.Manage.All https://mydomain.sharepoint.com/.default',
|
||||
expires_in: 3599,
|
||||
ext_expires_in: 3599,
|
||||
access_token: 'NEWACCESSTOKEN',
|
||||
refresh_token: 'NEWREFRESHTOKEN',
|
||||
});
|
||||
|
||||
// Retry request with new token: Return success
|
||||
nock(baseUrl)
|
||||
.get(itemPath)
|
||||
.matchHeader('Authorization', 'Bearer NEWACCESSTOKEN')
|
||||
.reply(200, {
|
||||
'@odata.context':
|
||||
'https://mydomain.sharepoint.com/sites/site1/_api/v2.0/$metadata#listItems/$entity',
|
||||
'@odata.etag': '"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1"',
|
||||
id: 'item1',
|
||||
createdDateTime: '2025-03-12T22:18:18Z',
|
||||
lastModifiedDateTime: '2025-03-12T22:18:18Z',
|
||||
webUrl: 'https://mydomain.sharepoint.com/sites/site1/Lists/name%20list/1_.000',
|
||||
'fields@odata.navigationLink': 'sites/site1/lists/list1/items/item1/fields',
|
||||
fields: {
|
||||
'@odata.etag': '"07bfcdd5-450d-48ce-8dc3-04f7f59edc5f,1"',
|
||||
Title: 'Item 1',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
nock.cleanAll();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
// Use the harness's setupTests to automatically run the workflow
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['getTokenRefresh.workflow.json'],
|
||||
customAssertions: () => {
|
||||
// Verify the token was refreshed and saved
|
||||
expect(updateCredentialsSpy).toHaveBeenCalledTimes(1);
|
||||
expect(updateCredentialsSpy.mock.calls[0][1]).toBe('microsoftSharePointOAuth2Api');
|
||||
expect(updateCredentialsSpy.mock.calls[0][2]).toMatchObject({
|
||||
oauthTokenData: expect.objectContaining({
|
||||
access_token: 'NEWACCESSTOKEN',
|
||||
refresh_token: 'NEWREFRESHTOKEN',
|
||||
}),
|
||||
});
|
||||
|
||||
// Verify all nock interceptors were called (401 -> refresh -> retry)
|
||||
expect(nock.isDone()).toBe(true);
|
||||
},
|
||||
});
|
||||
});
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "d8d29d0a-bb31-4094-a252-8008932f5425",
|
||||
"name": "When clicking 'Test workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "item",
|
||||
"operation": "get",
|
||||
"site": {
|
||||
"__rl": true,
|
||||
"value": "site1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "site1"
|
||||
},
|
||||
"list": {
|
||||
"__rl": true,
|
||||
"value": "list1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "list1"
|
||||
},
|
||||
"item": {
|
||||
"__rl": true,
|
||||
"value": "item1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "item1"
|
||||
},
|
||||
"requestOptions": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.microsoftSharePoint",
|
||||
"typeVersion": 1,
|
||||
"position": [200, 0],
|
||||
"id": "0e19be10-9d94-4654-89e9-432daa8102cb",
|
||||
"name": "Microsoft SharePoint",
|
||||
"credentials": {
|
||||
"microsoftSharePointOAuth2Api": {
|
||||
"id": "cXXnMCWyk397M5qJ",
|
||||
"name": "Microsoft SharePoint account"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"When clicking 'Test workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft SharePoint",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"pinData": {
|
||||
"Microsoft SharePoint": [
|
||||
{
|
||||
"json": {
|
||||
"id": "item1",
|
||||
"createdDateTime": "2025-03-12T22:18:18Z",
|
||||
"lastModifiedDateTime": "2025-03-12T22:18:18Z",
|
||||
"webUrl": "https://mydomain.sharepoint.com/sites/site1/Lists/name%20list/1_.000",
|
||||
"fields": {
|
||||
"Title": "Item 1"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
|
||||
import { credentials } from '../credentials';
|
||||
|
||||
describe('Microsoft SharePoint Node', () => {
|
||||
const { baseUrl } = credentials.microsoftSharePointOAuth2Api;
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['update.workflow.json'],
|
||||
nock: {
|
||||
baseUrl,
|
||||
mocks: [
|
||||
{
|
||||
method: 'patch',
|
||||
path: '/sites/site1/lists/list1/items/item1',
|
||||
statusCode: 200,
|
||||
requestBody: {
|
||||
fields: {
|
||||
Title: 'Title 2',
|
||||
},
|
||||
},
|
||||
responseBody: {
|
||||
'@odata.context':
|
||||
'https://mydomain.sharepoint.com/sites/site1/_api/v2.0/$metadata#listItems/$entity',
|
||||
'@odata.etag': '"cc40561f-3d3b-4cfb-b8a9-8af9d71de3f0,2"',
|
||||
createdBy: {
|
||||
user: {
|
||||
displayName: 'John Doe',
|
||||
email: 'john@doe.onmicrosoft.com',
|
||||
id: '5f7afebb-121d-4664-882b-a09fe6584ce0',
|
||||
},
|
||||
},
|
||||
createdDateTime: '2025-03-25T12:26:12Z',
|
||||
eTag: '"cc40561f-3d3b-4cfb-b8a9-8af9d71de3f0,2"',
|
||||
id: 'item1',
|
||||
lastModifiedBy: {
|
||||
application: {
|
||||
id: 'b9c26603-3c9b-4050-b848-27dfab0a52fa',
|
||||
displayName: 'sharepoint-n8n-test',
|
||||
},
|
||||
user: {
|
||||
displayName: 'John Doe',
|
||||
email: 'john@doe.onmicrosoft.com',
|
||||
id: '5f7afebb-121d-4664-882b-a09fe6584ce0',
|
||||
},
|
||||
},
|
||||
lastModifiedDateTime: '2025-03-25T12:26:46Z',
|
||||
parentReference: {
|
||||
id: '84070a73-ea24-463c-8eb2-0e9afa11c63f',
|
||||
listId: 'list1',
|
||||
siteId: 'site1',
|
||||
},
|
||||
webUrl: 'https://mydomain.sharepoint.com/sites/site1/Lists/name%20list/3_.000',
|
||||
contentType: {
|
||||
id: '0x010010D603DC4CF2DF4BB8A2D75DCB4BB1B30037A4993FB4DEB0439C3DC6DEC95A9DF8',
|
||||
name: 'Item',
|
||||
},
|
||||
'fields@odata.navigationLink': 'sites/site1/lists/list1/items/item1/fields',
|
||||
fields: {
|
||||
'@odata.etag': '"cc40561f-3d3b-4cfb-b8a9-8af9d71de3f0,2"',
|
||||
Title: 'Title 2',
|
||||
ID: 'item1',
|
||||
ContentType: 'Item',
|
||||
Modified: '2025-03-25T12:26:46Z',
|
||||
Created: '2025-03-25T12:26:12Z',
|
||||
AuthorLookupId: '7',
|
||||
EditorLookupId: '7',
|
||||
_UIVersionString: '2.0',
|
||||
Attachments: false,
|
||||
Edit: '',
|
||||
LinkTitleNoMenu: 'Title 2',
|
||||
LinkTitle: 'Title 2',
|
||||
ItemChildCount: '0',
|
||||
FolderChildCount: '0',
|
||||
_ComplianceFlags: '',
|
||||
_ComplianceTag: '',
|
||||
_ComplianceTagWrittenTime: '',
|
||||
_ComplianceTagUserId: '',
|
||||
AppAuthorLookupId: '5',
|
||||
AppEditorLookupId: '5',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,154 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "d8d29d0a-bb31-4094-a252-8008932f5425",
|
||||
"name": "When clicking ‘Test workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "item",
|
||||
"operation": "update",
|
||||
"site": {
|
||||
"__rl": true,
|
||||
"value": "site1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "site1"
|
||||
},
|
||||
"list": {
|
||||
"__rl": true,
|
||||
"value": "list1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "list1"
|
||||
},
|
||||
"columns": {
|
||||
"mappingMode": "defineBelow",
|
||||
"value": {
|
||||
"Title": "Title 2",
|
||||
"id": "item1"
|
||||
},
|
||||
"matchingColumns": ["id"],
|
||||
"schema": [
|
||||
{
|
||||
"id": "Title",
|
||||
"canBeUsedToMatch": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"displayName": "Title",
|
||||
"readOnly": false,
|
||||
"required": false,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "id",
|
||||
"canBeUsedToMatch": true,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"displayName": "ID",
|
||||
"readOnly": true,
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"removed": false
|
||||
}
|
||||
],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": false
|
||||
},
|
||||
"requestOptions": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.microsoftSharePoint",
|
||||
"typeVersion": 1,
|
||||
"position": [200, 0],
|
||||
"id": "0e19be10-9d94-4654-89e9-432daa8102cb",
|
||||
"name": "Microsoft SharePoint",
|
||||
"credentials": {
|
||||
"microsoftSharePointOAuth2Api": {
|
||||
"id": "cXXnMCWyk397M5qJ",
|
||||
"name": "Microsoft SharePoint account"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"When clicking ‘Test workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft SharePoint",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"pinData": {
|
||||
"Microsoft SharePoint": [
|
||||
{
|
||||
"json": {
|
||||
"@odata.context": "https://mydomain.sharepoint.com/sites/site1/_api/v2.0/$metadata#listItems/$entity",
|
||||
"@odata.etag": "\"cc40561f-3d3b-4cfb-b8a9-8af9d71de3f0,2\"",
|
||||
"createdBy": {
|
||||
"user": {
|
||||
"displayName": "John Doe",
|
||||
"email": "john@doe.onmicrosoft.com",
|
||||
"id": "5f7afebb-121d-4664-882b-a09fe6584ce0"
|
||||
}
|
||||
},
|
||||
"createdDateTime": "2025-03-25T12:26:12Z",
|
||||
"eTag": "\"cc40561f-3d3b-4cfb-b8a9-8af9d71de3f0,2\"",
|
||||
"id": "item1",
|
||||
"lastModifiedBy": {
|
||||
"application": {
|
||||
"id": "b9c26603-3c9b-4050-b848-27dfab0a52fa",
|
||||
"displayName": "sharepoint-n8n-test"
|
||||
},
|
||||
"user": {
|
||||
"displayName": "John Doe",
|
||||
"email": "john@doe.onmicrosoft.com",
|
||||
"id": "5f7afebb-121d-4664-882b-a09fe6584ce0"
|
||||
}
|
||||
},
|
||||
"lastModifiedDateTime": "2025-03-25T12:26:46Z",
|
||||
"parentReference": {
|
||||
"id": "84070a73-ea24-463c-8eb2-0e9afa11c63f",
|
||||
"listId": "list1",
|
||||
"siteId": "site1"
|
||||
},
|
||||
"webUrl": "https://mydomain.sharepoint.com/sites/site1/Lists/name%20list/3_.000",
|
||||
"contentType": {
|
||||
"id": "0x010010D603DC4CF2DF4BB8A2D75DCB4BB1B30037A4993FB4DEB0439C3DC6DEC95A9DF8",
|
||||
"name": "Item"
|
||||
},
|
||||
"fields@odata.navigationLink": "sites/site1/lists/list1/items/item1/fields",
|
||||
"fields": {
|
||||
"@odata.etag": "\"cc40561f-3d3b-4cfb-b8a9-8af9d71de3f0,2\"",
|
||||
"Title": "Title 2",
|
||||
"ID": "item1",
|
||||
"ContentType": "Item",
|
||||
"Modified": "2025-03-25T12:26:46Z",
|
||||
"Created": "2025-03-25T12:26:12Z",
|
||||
"AuthorLookupId": "7",
|
||||
"EditorLookupId": "7",
|
||||
"_UIVersionString": "2.0",
|
||||
"Attachments": false,
|
||||
"Edit": "",
|
||||
"LinkTitleNoMenu": "Title 2",
|
||||
"LinkTitle": "Title 2",
|
||||
"ItemChildCount": "0",
|
||||
"FolderChildCount": "0",
|
||||
"_ComplianceFlags": "",
|
||||
"_ComplianceTag": "",
|
||||
"_ComplianceTagWrittenTime": "",
|
||||
"_ComplianceTagUserId": "",
|
||||
"AppAuthorLookupId": "5",
|
||||
"AppEditorLookupId": "5"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
|
||||
import { credentials } from '../credentials';
|
||||
|
||||
describe('Microsoft SharePoint Node', () => {
|
||||
const { baseUrl } = credentials.microsoftSharePointOAuth2Api;
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['upsert.workflow.json'],
|
||||
nock: {
|
||||
baseUrl,
|
||||
mocks: [
|
||||
{
|
||||
method: 'get',
|
||||
path: '/sites/site1/lists/list1/items?%24filter=fields%2FTitle%20eq%20%27Title%201%27',
|
||||
statusCode: 200,
|
||||
requestHeaders: {
|
||||
Prefer: 'HonorNonIndexedQueriesWarningMayFailRandomly',
|
||||
},
|
||||
responseBody: {
|
||||
'@odata.context':
|
||||
'https://mydomain.sharepoint.com/sites/site1/_api/v2.0/$metadata#listItems',
|
||||
value: [
|
||||
{
|
||||
'@odata.etag': '"0ea4148a-f8e5-4f2f-a815-2e2be693b164,2"',
|
||||
createdBy: {
|
||||
user: {
|
||||
displayName: 'John Doe',
|
||||
email: 'john@doe.onmicrosoft.com',
|
||||
id: '5f7afebb-121d-4664-882b-a09fe6584ce0',
|
||||
},
|
||||
},
|
||||
createdDateTime: '2025-03-25T12:48:45Z',
|
||||
eTag: '"0ea4148a-f8e5-4f2f-a815-2e2be693b164,2"',
|
||||
id: 'item1',
|
||||
lastModifiedBy: {
|
||||
application: {
|
||||
id: 'b9c26603-3c9b-4050-b848-27dfab0a52fa',
|
||||
displayName: 'sharepoint-n8n-test',
|
||||
},
|
||||
user: {
|
||||
displayName: 'John Doe',
|
||||
email: 'john@doe.onmicrosoft.com',
|
||||
id: '5f7afebb-121d-4664-882b-a09fe6584ce0',
|
||||
},
|
||||
},
|
||||
lastModifiedDateTime: '2025-03-25T13:01:45Z',
|
||||
parentReference: {
|
||||
id: '0ead9135-9622-4b6d-b319-6b8810a6dc60',
|
||||
listId: 'list1',
|
||||
siteId: 'site1',
|
||||
},
|
||||
webUrl: 'https://mydomain.sharepoint.com/sites/site1/Lists/test/19_.000',
|
||||
contentType: {
|
||||
id: '0x0100362657F7588C5C438072A77E0EF184F4000272C0D1046D984B8097B3C00D199EDE',
|
||||
name: 'Item',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
method: 'patch',
|
||||
path: '/sites/site1/lists/list1/items/item1',
|
||||
statusCode: 200,
|
||||
requestBody: {
|
||||
fields: {
|
||||
Title: 'Title 1',
|
||||
},
|
||||
},
|
||||
responseBody: {
|
||||
'@odata.context':
|
||||
'https://mydomain.sharepoint.com/sites/site1/_api/v2.0/$metadata#listItems/$entity',
|
||||
'@odata.etag': '"cc40561f-3d3b-4cfb-b8a9-8af9d71de3f0,2"',
|
||||
createdBy: {
|
||||
user: {
|
||||
displayName: 'John Doe',
|
||||
email: 'john@doe.onmicrosoft.com',
|
||||
id: '5f7afebb-121d-4664-882b-a09fe6584ce0',
|
||||
},
|
||||
},
|
||||
createdDateTime: '2025-03-25T12:26:12Z',
|
||||
eTag: '"cc40561f-3d3b-4cfb-b8a9-8af9d71de3f0,2"',
|
||||
id: 'item1',
|
||||
lastModifiedBy: {
|
||||
application: {
|
||||
id: 'b9c26603-3c9b-4050-b848-27dfab0a52fa',
|
||||
displayName: 'sharepoint-n8n-test',
|
||||
},
|
||||
user: {
|
||||
displayName: 'John Doe',
|
||||
email: 'john@doe.onmicrosoft.com',
|
||||
id: '5f7afebb-121d-4664-882b-a09fe6584ce0',
|
||||
},
|
||||
},
|
||||
lastModifiedDateTime: '2025-03-25T12:26:46Z',
|
||||
parentReference: {
|
||||
id: '84070a73-ea24-463c-8eb2-0e9afa11c63f',
|
||||
listId: 'list1',
|
||||
siteId: 'site1',
|
||||
},
|
||||
webUrl: 'https://mydomain.sharepoint.com/sites/site1/Lists/name%20list/3_.000',
|
||||
contentType: {
|
||||
id: '0x010010D603DC4CF2DF4BB8A2D75DCB4BB1B30037A4993FB4DEB0439C3DC6DEC95A9DF8',
|
||||
name: 'Item',
|
||||
},
|
||||
'fields@odata.navigationLink': 'sites/site1/lists/list1/items/item1/fields',
|
||||
fields: {
|
||||
'@odata.etag': '"cc40561f-3d3b-4cfb-b8a9-8af9d71de3f0,2"',
|
||||
Title: 'Title 1',
|
||||
ID: 'item1',
|
||||
ContentType: 'Item',
|
||||
Modified: '2025-03-25T12:26:46Z',
|
||||
Created: '2025-03-25T12:26:12Z',
|
||||
AuthorLookupId: '7',
|
||||
EditorLookupId: '7',
|
||||
_UIVersionString: '2.0',
|
||||
Attachments: false,
|
||||
Edit: '',
|
||||
LinkTitleNoMenu: 'Title 1',
|
||||
LinkTitle: 'Title 1',
|
||||
ItemChildCount: '0',
|
||||
FolderChildCount: '0',
|
||||
_ComplianceFlags: '',
|
||||
_ComplianceTag: '',
|
||||
_ComplianceTagWrittenTime: '',
|
||||
_ComplianceTagUserId: '',
|
||||
AppAuthorLookupId: '5',
|
||||
AppEditorLookupId: '5',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,143 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "d8d29d0a-bb31-4094-a252-8008932f5425",
|
||||
"name": "When clicking ‘Test workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "item",
|
||||
"operation": "upsert",
|
||||
"site": {
|
||||
"__rl": true,
|
||||
"value": "site1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "site1"
|
||||
},
|
||||
"list": {
|
||||
"__rl": true,
|
||||
"value": "list1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "list1"
|
||||
},
|
||||
"columns": {
|
||||
"mappingMode": "defineBelow",
|
||||
"value": {
|
||||
"Title": "Title 1"
|
||||
},
|
||||
"matchingColumns": ["Title"],
|
||||
"schema": [
|
||||
{
|
||||
"id": "Title",
|
||||
"canBeUsedToMatch": true,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"displayName": "Title",
|
||||
"readOnly": false,
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"removed": false
|
||||
}
|
||||
],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": false
|
||||
},
|
||||
"requestOptions": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.microsoftSharePoint",
|
||||
"typeVersion": 1,
|
||||
"position": [200, 0],
|
||||
"id": "0e19be10-9d94-4654-89e9-432daa8102cb",
|
||||
"name": "Microsoft SharePoint",
|
||||
"credentials": {
|
||||
"microsoftSharePointOAuth2Api": {
|
||||
"id": "cXXnMCWyk397M5qJ",
|
||||
"name": "Microsoft SharePoint account"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"When clicking ‘Test workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft SharePoint",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"pinData": {
|
||||
"Microsoft SharePoint": [
|
||||
{
|
||||
"json": {
|
||||
"@odata.context": "https://mydomain.sharepoint.com/sites/site1/_api/v2.0/$metadata#listItems/$entity",
|
||||
"@odata.etag": "\"cc40561f-3d3b-4cfb-b8a9-8af9d71de3f0,2\"",
|
||||
"createdBy": {
|
||||
"user": {
|
||||
"displayName": "John Doe",
|
||||
"email": "john@doe.onmicrosoft.com",
|
||||
"id": "5f7afebb-121d-4664-882b-a09fe6584ce0"
|
||||
}
|
||||
},
|
||||
"createdDateTime": "2025-03-25T12:26:12Z",
|
||||
"eTag": "\"cc40561f-3d3b-4cfb-b8a9-8af9d71de3f0,2\"",
|
||||
"id": "item1",
|
||||
"lastModifiedBy": {
|
||||
"application": {
|
||||
"id": "b9c26603-3c9b-4050-b848-27dfab0a52fa",
|
||||
"displayName": "sharepoint-n8n-test"
|
||||
},
|
||||
"user": {
|
||||
"displayName": "John Doe",
|
||||
"email": "john@doe.onmicrosoft.com",
|
||||
"id": "5f7afebb-121d-4664-882b-a09fe6584ce0"
|
||||
}
|
||||
},
|
||||
"lastModifiedDateTime": "2025-03-25T12:26:46Z",
|
||||
"parentReference": {
|
||||
"id": "84070a73-ea24-463c-8eb2-0e9afa11c63f",
|
||||
"listId": "list1",
|
||||
"siteId": "site1"
|
||||
},
|
||||
"webUrl": "https://mydomain.sharepoint.com/sites/site1/Lists/name%20list/3_.000",
|
||||
"contentType": {
|
||||
"id": "0x010010D603DC4CF2DF4BB8A2D75DCB4BB1B30037A4993FB4DEB0439C3DC6DEC95A9DF8",
|
||||
"name": "Item"
|
||||
},
|
||||
"fields@odata.navigationLink": "sites/site1/lists/list1/items/item1/fields",
|
||||
"fields": {
|
||||
"@odata.etag": "\"cc40561f-3d3b-4cfb-b8a9-8af9d71de3f0,2\"",
|
||||
"Title": "Title 1",
|
||||
"ID": "item1",
|
||||
"ContentType": "Item",
|
||||
"Modified": "2025-03-25T12:26:46Z",
|
||||
"Created": "2025-03-25T12:26:12Z",
|
||||
"AuthorLookupId": "7",
|
||||
"EditorLookupId": "7",
|
||||
"_UIVersionString": "2.0",
|
||||
"Attachments": false,
|
||||
"Edit": "",
|
||||
"LinkTitleNoMenu": "Title 1",
|
||||
"LinkTitle": "Title 1",
|
||||
"ItemChildCount": "0",
|
||||
"FolderChildCount": "0",
|
||||
"_ComplianceFlags": "",
|
||||
"_ComplianceTag": "",
|
||||
"_ComplianceTagWrittenTime": "",
|
||||
"_ComplianceTagUserId": "",
|
||||
"AppAuthorLookupId": "5",
|
||||
"AppEditorLookupId": "5"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user