@@ -412,6 +412,70 @@ public IEnumerable<AzureDevOpsBuildArtifact> GetArtifacts()
412
412
}
413
413
}
414
414
415
+ /// <summary>
416
+ /// Create an artifact link, such as a file or folder path or a version control path.
417
+ /// </summary>
418
+ /// <param name="name">The artifact name.</param>
419
+ /// <param name="type">The artifact type.
420
+ /// The following artifact types are supported:
421
+ /// <list type="table">
422
+ /// <listheader>
423
+ /// <term>Type</term>
424
+ /// <description>Description</description>
425
+ /// </listheader>
426
+ /// <item>
427
+ /// <term>FilePath</term>
428
+ /// <description>File path type</description>
429
+ /// </item>
430
+ /// <item>
431
+ /// <term>GitRef</term>
432
+ /// <description>Git reference type</description>
433
+ /// </item>
434
+ /// <item>
435
+ /// <term>TFVCLabel</term>
436
+ /// <description>TFVC label type</description>
437
+ /// </item>
438
+ /// <item>
439
+ /// <term>VersionControl</term>
440
+ /// <description>Version control path type</description>
441
+ /// </item>
442
+ /// </list>
443
+ /// </param>
444
+ /// <param name="location">The link path or value.</param>
445
+ /// <returns>Description of the new artifact or <c>null</c> if no build could be found and
446
+ /// <see cref="AzureDevOpsBuildSettings.ThrowExceptionIfBuildCouldNotBeFound"/> is set to <c>false</c>.</returns>
447
+ /// <exception cref="AzureDevOpsBuildNotFoundException">If build could not be found and
448
+ /// <see cref="AzureDevOpsBuildSettings.ThrowExceptionIfBuildCouldNotBeFound"/> is set to <c>true</c>.</exception>
449
+ public AzureDevOpsBuildArtifact LinkArtifact ( string name , string type , string location )
450
+ {
451
+ if ( ! this . ValidateBuild ( ) )
452
+ {
453
+ return null ;
454
+ }
455
+
456
+ using ( var buildClient = this . buildClientFactory . CreateBuildClient ( this . CollectionUrl , this . credentials ) )
457
+ {
458
+ var artifact =
459
+ new BuildArtifact
460
+ {
461
+ Name = name ,
462
+ Resource =
463
+ new ArtifactResource
464
+ {
465
+ Type = type ,
466
+ Data = location ,
467
+ } ,
468
+ } ;
469
+ return
470
+ buildClient
471
+ . CreateArtifactAsync ( artifact , this . ProjectId , this . BuildId )
472
+ . ConfigureAwait ( false )
473
+ . GetAwaiter ( )
474
+ . GetResult ( )
475
+ . ToAzureDevOpsBuildArtifact ( ) ;
476
+ }
477
+ }
478
+
415
479
/// <summary>
416
480
/// Gets the test run ID's of a build.
417
481
/// </summary>
0 commit comments