To create a file in Azure Pipeline and save it in SharePoint using the command line, follow these steps:
First, ensure that you have the necessary permissions and access to the SharePoint site where you want to save the file.
In your Azure Pipeline, add a Command Line task.
In the Command Line task, use the echo
command to create the content of the file. For example, to create a new file named example.txt
with the content Hello World!
, you can use the following command:
echo "Hello World!" > example.txt
curl
command to make a POST request to the SharePoint site. The command should look like the following:curl --ntlm -u username:password -T example.txt "https://yourdomain.sharepoint.com/sites/yoursite/_api/web/GetFolderByServerRelativeUrl('/Shared%20Documents/')/Files/add(url='example.txt',overwrite=true)"
Replace username
and password
with your SharePoint credentials. Replace yourdomain.sharepoint.com
with the URL of your SharePoint site, and yoursite
with the name of the SharePoint site. In the example above, the file is saved in the Shared Documents
folder. You can change the folder by modifying the GetFolderByServerRelativeUrl
parameter.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-07-12 15:05:22 +0000
Seen: 10 times
Last updated: Jul 12 '23
How can I install Beegfs on Ubuntu 22.04?
How can a .zip file from GitHub be loaded into Google Colab?
What is the process of using the Multmerge() function in r to combine files in a directory?
In Mac, what is the method to increase the privileges of an executable through setuid?
What can be done to resolve the issue with the Untracked working tree file named '._.git'?
What are the steps to restrict the overall file size of uploaded files in NestJS using multer?