Solid Edge Framework Type Library
FindSEDocumentsContainingText Method
Solid Edge Framework Type Library > Application Object : FindSEDocumentsContainingText Method
Text to be searched as string
Define the scope of search. Specify path of the folder as shown in below sample code
File type as string. Presently only applicable for draft files.
True if you would like to search
Returns array of files
Description
Returns the list of Solid Edge files that contain given text.
Syntax
Visual Basic
Public Sub FindSEDocumentsContainingText( _
   ByVal text_to_search As String, _
   ByRef psaScope() As Variant, _
   ByVal file_types As String, _
   ByVal bIncludeSubFolders As Boolean, _
   ByRef FilesFoundInSearch() As String _
) 
Parameters
text_to_search
Text to be searched as string
psaScope
Define the scope of search. Specify path of the folder as shown in below sample code
file_types
File type as string. Presently only applicable for draft files.
bIncludeSubFolders
True if you would like to search
FilesFoundInSearch
Returns array of files
Remarks
Before using this API make sure that the folder containing target draft document is indexed.
Example
Imports System.Runtime.InteropServices
Imports System.IO

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim objApp As SolidEdgeFramework.Application = Nothing
        Dim Scope(0 To 1) As Object
        Dim FileNames(0 To 1) As Object

        Try

            If objApp Is Nothing Then
                Try
                    objApp = GetObject(, "SolidEdge.Application")
                Catch ex As Exception
                End Try

                If objApp Is Nothing Then
                    objApp = CreateObject("SolidEdge.Application")
                End If
            End If
            'Make sure that the folder is indexed.
            Scope(0) = "C:\Program Files\Solid Edge ST10\Training"
            objApp.Visible = True
            objApp.FindSEDocumentsContainingText("TestText", Scope, ".dft", True, FileNames)
        Catch ex As Exception
            MsgBox("Exception occurred " & ex.Message)
        End Try

    End Sub
    
End Class
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.IO;

public class Form1
{

    private void Button1_Click(object sender, EventArgs e)
    {
        SolidEdgeFramework.Application objApp = null;
        object[] Scope = new object[2];
        object[] FileNames = new object[2];

        try
        {

            if (objApp == null)
            {
                try
                {
                    objApp = Microsoft.VisualBasic.Interaction.GetObject(null, "SolidEdge.Application");
                }
                catch (Exception ex)
                {
                }

                if (objApp == null)
                {
                    objApp = System.Activator.CreateInstance(System.Type.GetTypeFromProgID("SolidEdge.Application"));
                }
            }
            //Make sure that the folder is indexed.
            Scope[0] = "C:\\Program Files\\Solid Edge ST10\\Training";
            objApp.Visible = true;
            objApp.FindSEDocumentsContainingText("TestText", Scope, ".dft", true, FileNames);
        }
        catch (Exception ex)
        {
            MessageBox.Show("Exception occurred " + ex.Message);
        }

    }


    public Form1()
    {
        SubscribeToEvents();
    }

//
    private bool EventsSubscribed = false;
    private void SubscribeToEvents()
    {
        if (EventsSubscribed)
            return;
        else
            EventsSubscribed = true;

        Button1.Click += Button1_Click;
        Button1.Click += Button1_Click;
        Button1.Click += Button1_Click;
    }

}
See Also

Application Object  | Application Members