ArcGIS Pro 2.9 API Reference Guide
AddAttachment(RowToken,String) Method
Example 

ArcGIS.Desktop.Editing Namespace > EditOperation Class > AddAttachment Method : AddAttachment(RowToken,String) Method
The RowToken representing the future feature to add the attachment to.
The filesystem path to the file to attach to the feature.
Add an attachment to a row/feature with attachment support.
Syntax
public void AddAttachment( 
   RowToken token,
   string filePath
)
Public Overloads Sub AddAttachment( _
   ByVal token As RowToken, _
   ByVal filePath As String _
) 

Parameters

token
The RowToken representing the future feature to add the attachment to.
filePath
The filesystem path to the file to attach to the feature.
Remarks
This method is used to add an attachment to a future feature returned from the EditOperation.CreateEx method. The RowToken allows feature to be created and the attachment added within the same EditOperation, without the need for chaining.
Example
//ArcGIS Pro 2.5 extends the EditOperation.AddAttachment method to take a RowToken as a paramter.
//This allows you to create a feature, using EditOperation.CreateEx, and add an attachment in one transaction.

var editOpAttach = new EditOperation();
editOperation1.Name = string.Format("Create point in '{0}'", CurrentTemplate.Layer.Name);

var attachRowToken = editOpAttach.CreateEx(this.CurrentTemplate, polygon);
editOpAttach.AddAttachment(attachRowToken, @"c:\temp\image.jpg");

//Must be within a QueuedTask
editOpAttach.Execute();
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

EditOperation Class
EditOperation Members
Overload List