ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.KnowledgeGraph Namespace / KnowledgeGraphInvestigationProjectItem Class / GetInvestigation Method
Example

In This Topic
    GetInvestigation Method
    In This Topic
    Returns a knowledge graph investigation. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Function GetInvestigation() As KnowledgeGraphInvestigation
    public KnowledgeGraphInvestigation GetInvestigation()

    Return Value

    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Open an existing investigation
    {
      // open an existing investigation
      var investigationProjectItems = Project.Current.GetItems<KnowledgeGraphInvestigationProjectItem>();
      var investigationProjectItem = investigationProjectItems.FirstOrDefault(ipi => ipi.Name.Equals("myInvestigation"));
      await QueuedTask.Run(() =>
      {
        KnowledgeGraphInvestigation investigation = investigationProjectItem.GetInvestigation();
        ProApp.Panes.CreateInvestigationPaneAsync(investigation);
    
    
        // or 
        investigation.OpenViewAsync();
      });
    
      // or 
      investigationProjectItem.OpenInvestigationPaneAsync();
    }
    Get the panes for an investigation
    {
      // open an existing investigation
      var investigationProjectItems = Project.Current.GetItems<KnowledgeGraphInvestigationProjectItem>();
      var investigationProjectItem = investigationProjectItems.FirstOrDefault(ipi => ipi.Name.Equals("myInvestigation"));
      await QueuedTask.Run(() =>
      {
        KnowledgeGraphInvestigation investigation = investigationProjectItem.GetInvestigation();
        var panes = investigation.GetInvestigationPanes();
    
        foreach (var pane in panes)
        {
          KnowledgeGraphInvestigationView kgView = pane.InvestigationView;
          // if it's the active investigation view
          if (kgView == KnowledgeGraphInvestigationView.Active)
          {
            // do something
          }
        }
      });
    }
    Activate an existing investigation view
    {
      //Confirm if investigation exists as a project item
      KnowledgeGraphInvestigationProjectItem investigationItem =
         Project.Current.GetItems<KnowledgeGraphInvestigationProjectItem>().FirstOrDefault(
                                                            item => item.Name.Equals("myInvestigation"));
      if (investigationItem != null)
      {
        KnowledgeGraphInvestigation investigation =
           await QueuedTask.Run(() => investigationItem.GetInvestigation());
    
        // see if a view is already open that references the same investigation
        foreach (var investigationPane in ProApp.Panes.OfType<IKnowledgeGraphInvestigationPane>())
        {
          //if there is a match, activate the view
          if (investigationPane.InvestigationView.Investigation == investigation)
          {
            (investigationPane as Pane).Activate();
            return;
          }
        }
      }
    }
    Requirements

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

    ArcGIS Pro version: 3.5 or higher.
    See Also