From 5f0d0afdbab27982c1a28d5853971057db93c52d Mon Sep 17 00:00:00 2001 From: mhorak Date: Thu, 14 Aug 2025 06:46:12 +0000 Subject: [PATCH] Update Sharepoint.yaml --- Sharepoint.yaml | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/Sharepoint.yaml b/Sharepoint.yaml index 74defd7..b1dc836 100644 --- a/Sharepoint.yaml +++ b/Sharepoint.yaml @@ -1,6 +1,6 @@ --- - name: Post patching results to SharePoint (Graph) - hosts: localhost + hosts: windows gather_facts: false vars: tenant_id: "{{ lookup('env', 'SP_TENANT_ID') }}" @@ -27,6 +27,29 @@ URL={{ job_url }}. tasks: + - name: Verify siteId resolves + uri: + url: "https://graph.microsoft.com/v1.0/sites/{{ site_id }}" + method: GET + headers: { Authorization: "Bearer {{ graph_token.json.access_token }}" } + return_content: true + status_code: 200 + register: site_probe + no_log: true + + - name: List lists to confirm listId (name + id) + uri: + url: "https://graph.microsoft.com/v1.0/sites/{{ site_id }}/lists?$select=id,displayName" + method: GET + headers: { Authorization: "Bearer {{ graph_token.json.access_token }}" } + return_content: true + status_code: 200 + register: lists_probe + no_log: true + +- name: Show lists (sanitized) + debug: + msg: "{{ (lists_probe.json.value | default([])) | map(attribute='displayName') | list }}" - name: Acquire Graph token (client credentials) uri: url: "https://login.microsoftonline.com/{{ tenant_id }}/oauth2/v2.0/token" @@ -42,6 +65,20 @@ no_log: true failed_when: graph_token.status not in [200] + - name: Inspect columns (internal names) + uri: + url: "https://graph.microsoft.com/v1.0/sites/{{ site_id }}/lists/{{ list_id }}/columns?$select=name,displayName,columnType" + method: GET + headers: { Authorization: "Bearer {{ graph_token.json.access_token }}" } + return_content: true + status_code: 200 + register: cols_probe + no_log: true + +- name: Print internal names + debug: + var: cols_probe.json.value | map(attribute='name') | list + - name: Create SharePoint list item (Graph) uri: url: "https://graph.microsoft.com/v1.0/sites/{{ site_id }}/lists/{{ list_id }}/items"