halliba / az-pipelines-2-sharepoint

Azure DevOps extension - upload build files to SharePoint Online
GNU General Public License v3.0
9 stars 4 forks source link

[Question] How to specifiy to upload one single file? #1

Closed pri-kise closed 2 years ago

pri-kise commented 2 years ago

Hi ,

we are currently using another Azure DevOps Extension to upload a .zip containing multiple artifacts to the Sharepoint.

In the other extension (https://marketplace.visualstudio.com/items?itemName=projectumapsvsts.upload-sp-files-app&targetId=e90a45e5-af43-4897-8059-b28e1d8ebea2) we could simple specify the file(s) in one field.

e.g. XXX-$(Release.ReleaseName).zip

Could you help me to understand the difference between the parameter sourceFolder and contents? How would I specify this with the input contents. And maybe you could add a helpMarkDown to this input to clarify if masks like *.app are supported?

halliba commented 2 years ago

Hi,

the parameters are based on the basic copy file task.

If you want to copy a single file, you can leave the sourceFolder-parameter blank and add the relative path to your file to the contens-parameter, e.g.: some/relative/folder/myfile.zip. (relative to $(Build.SourcesDirectory)).

The contents-parameter accepts glob patterns, that can be handled by node-glob. So, yes *.app should work.

ThesourceFolder-parameter ist mostly used to change the root of the copy task, e.g. to the $(Build.ArtifactsStagingDirectory). Because these directories can not be accessed via relative path specs from the$(Build.SourcesDirectory).

Anyway I will add some more hints and helpMarkDown to the task in the next days. Thank you for your feedback!

Greetings, halliba

pri-kise commented 2 years ago

Hi Valentin,

thanks for the clarification.

Now I get it to work. I had some difficulties finding the correct drive id, but with help of the Graph Explorer I solved it. Maybe you can add to the Readme some explanation how to retrieve the Drive ID if one has only the full webclient url.

I solved it by recursive request the sites

GET https://graph.microsoft.com/v1.0/sites/{site-id}/sites
GET https://graph.microsoft.com/v1.0/sites/{child-side-id}/sites

until I had the correct site to request the drives:

GET https://graph.microsoft.com/v1.0/sites/{child-side-id}/drives

Best regards

Kilian