ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Editing.Attributes Namespace / Inspector Class / Load Method / Load(Table,Int64) Method
A table from the geodatabase.
The object ID to load.
Example

In This Topic
    Load(Table,Int64) Method
    In This Topic
    Load multiple table rows into the inspector. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Overloads Sub Load( _
       ByVal table As Table, _
       ByVal oid As Long _
    ) 
    public void Load( 
       Table table,
       long oid
    )

    Parameters

    table
    A table from the geodatabase.
    oid
    The object ID to load.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Read from a raster field
    await QueuedTask.Run(() =>
    {
      var sel = MapView.Active.Map.GetSelection();
    
      //Read a raster from a raster field as an InteropBitmap
      //the bitmap can then be used as an imagesource or written to disk
      var insp = new ArcGIS.Desktop.Editing.Attributes.Inspector();
      insp.Load(sel.ToDictionary().Keys.First(), sel.ToDictionary().Values.First());
      var ibmp = insp["Photo"] as System.Windows.Interop.InteropBitmap;
    });
    Write an image to a raster field
    await QueuedTask.Run(() =>
    {
      var sel = MapView.Active.Map.GetSelection();
    
      //Insert an image into a raster field
      //Image will be written with no compression
      var insp = new ArcGIS.Desktop.Editing.Attributes.Inspector();
      insp.Load(sel.ToDictionary().Keys.First(), sel.ToDictionary().Values.First());
      insp["Photo"] = @"e:\temp\Hydrant.jpg";
    
      var op = new EditOperation() { Name = "Raster Inspector" };
      op.Modify(insp);
      if (!op.IsEmpty)
      {
        var result = op.Execute(); //Execute and ExecuteAsync will return true if the operation was successful and false if not
      }
    });
    Update Annotation Text via attribute.
    {
      var oid = 1;
    
      // See "Change Annotation Text Graphic" for an alternative if TEXTSTRING is missing from the schema
    
      // Note: QueuedTask is required to access the Inspector
      {
        // use the inspector methodology
        var insp = new Inspector();
        insp.Load(annotationLayer, oid);
    
        // make sure TextString attribute exists.
        //It is not guaranteed to be in the schema
        ArcGIS.Desktop.Editing.Attributes.Attribute att = insp.FirstOrDefault(a => a.FieldName == "TEXTSTRING");
        if (att != null)
        {
          insp["TEXTSTRING"] = "Hello World";
    
          //create and execute the edit operation
          EditOperation op = new EditOperation();
          op.Name = "Update annotation";
          op.Modify(insp);
    
          //OR using a Dictionary - again TEXTSTRING has to exist in the schema
          //Dictionary<string, object> newAtts = new Dictionary<string, object>();
          //newAtts.Add("TEXTSTRING", "hello world");
          //op.Modify(annotationLayer, oid, newAtts);
    
          op.Execute();
        }
      }
    }
    Edit the attributes of a FeatureSceneLayer
    {
      //must support editing!
      if (!featSceneLayer.HasAssociatedFeatureService ||
          !featSceneLayer.IsEditable)
        return;
    
      // Note: call within QueuedTask.Run()
      {
        var editOp = new EditOperation()
        {
          Name = "Edit FeatureSceneLayer Attributes",
          SelectModifiedFeatures = true
        };
        //make an inspector
        var inspector = new Inspector();
        //get the attributes for the specified oid
        inspector.Load(featSceneLayer, oid);
        inspector["PermitNotes"] = "test";//modify
        editOp.Modify(inspector);
        editOp.Execute();//synchronous flavor
      }
    }
    Select features via the MapView
    {
      //assume the geometry used in SelectFeaturesEx() is coming from a 
      //map tool...
      //SketchType = SketchGeometryType.Rectangle;
      //SketchOutputMode = SketchOutputMode.Screen;
    
      // Note: call within QueuedTask.Run()
      {
        var result = MapView.Active.SelectFeaturesEx(geometry);
        //Get scene layers with selections
        var scene_layers = result.ToDictionary<FeatureSceneLayer>();
        foreach (var kvp in scene_layers)
        {
          var scene_layer = kvp.Key as FeatureSceneLayer;
          var sel_oids = kvp.Value;
          //If there are attributes then get them
          if (scene_layer.HasAssociatedFeatureService)
          {
            var insp = new Inspector();
            foreach (var objectid in sel_oids)
            {
              insp.Load(scene_layer, objectid);
              //TODO something with retrieved attributes
            }
          }
        }
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also