Monday, March 28, 2022

[SOLVED] How to send artifact from GitLab to Teams

Issue

I want to send an artifact from GitLab to Microsoft Team using --curl, does anyone know how I can do that? The main idea send file as attachment to Teams using curl command.

N.B. href="https://stackoverflow.com/questions/67702653/how-to-send-commit-changes-from-gitlab-to-teams">I know how to send a text, but also need to send attachment.


Solution

I don't think it's possible to attach an -actual- file to a Teams message, rather you can link to a file that sits somewhere else, like most specifically in the SharePoint site for the Team itself, for example. So, you would, as an example:

  1. User Graph to upload the file to the SharePoint site for the Team (basically the "Files" tab in Teams)
  2. Send a Teams message using Graph, referencing the attachment. Here is an example:

https://docs.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http#example-4-send-a-message-with-file-attachment-in-it



Answered By - Hilton Giesenow
Answer Checked By - Mary Flores (WPSolving Volunteer)