Good Morning All,
I'm working on evolution three of my project. Issue: I'm trying to search the repository and find every instance where a tag labeled "Document Closed and Ready for Export" has been set. This is triggered when a checkbox is checked on the main form. For testing purposes I'm not implementing that phase, merely telling the app to search everything
My code is as follows, and does work, except for the tag locating. I'm trying to use the .NET RA and such rather than the old LFSO. I used a reference found in the LF SDK 9 help files, but I think once again, I'm not using the new procedures properly.
I've ID'ed the code I'm working with using the rem statement ' *********************************TAG CODE ***********************************************
The code for the search is as follows.
My question is, what is the proper setup for finding the checked tag?
Regards,
Brian
Try
ToolStripStatusLabel1.Text = "Beginning data export of Laserfiche files. This may take some time. Please be patient."
' Setting up the connection to the Repository
Dim serverName As String = CMBLaserficheServerName.Text, repositoryName As String = CMBRepositoryName.Text
Dim userName As String = CMBLaserficheRepositoryUserLogin.Text, userPassword As String = CMBLaserficheRepositoryUserPassword.Text
Dim mySession As New Session
Dim startDate As String = DateandTimeStart.Value
Dim endDate As String = DateandTimeEnd.Value
Dim listing As New List(Of String)
' *********************************TAG CODE ***********************************************
Dim GetInfo(Tags.Equals(Tag("Document Closed and Ready for Export")))
'***********************************TAG CODE***********************************************
' Log into the Repository
mySession.LogIn(userName, userPassword, New RepositoryRegistration(serverName, repositoryName))
' Instantiate the search objects...
Dim searchParameters As String = "{LF:Name=""*"", Type=""DB""} & {LF:Created>=""" & startDate & """, Created<=""" & endDate & """} "
Dim lfSearch As Search = New Search(mySession, searchParameters)
Dim settings As SearchListingSettings = New SearchListingSettings
Dim searchResults As SearchResultListing
' What columns do you want the search to retrieve...
settings.AddColumn(SystemColumn.Name)
settings.AddColumn(SystemColumn.CreationDate)
settings.AddColumn(SystemColumn.EntryType)
settings.AddColumn(SystemColumn.Path)
settings.AddColumn(SystemColumn.Tags)
' Run the search...
ToolStripStatusLabel1.Text = "Searching the repository for entries that match the search criteria."
lfSearch.Run()
' Get the results...
searchResults = lfSearch.GetResultListing(settings)
' If there are any results then step through them...
If searchResults.RowCount > 0 Then
' In this case I am just adding the document name and the creation date to the list...
For i As Integer = 1 To searchResults.RowCount
' Write text to the listbox output
ListBox1.Items.Add(searchResults.GetDatumAsString(i, SystemColumn.Path) _
& " " & searchResults.GetDatumAsString(i, SystemColumn.Name) _
& " " & searchResults.GetDatumAsString(i, SystemColumn.EntryType) _
& " " & searchResults.GetDatumAsString(i, SystemColumn.CreationDate) _
& " " & searchResults.GetDatumAsString(i, SystemColumn.Tags))
' Prep for getting or creating file to write text to the output log
Dim outputFile As StreamWriter
' Create file on server
File.Create(CMBOutputLogFileLocation.Text).Dispose()
outputFile = File.CreateText(CMBOutputLogFileLocation.Text)
' Write the items in the listbox into a file chosen by the user
ToolStripStatusLabel1.Text = "Writing document entry list to output file"
outputFile.WriteLine("Document gathering starting." & DateAndTime.Today & DateAndTime.TimeOfDay)
Dim ii As Integer = 0
While ii < ListBox1.Items.Count
outputFile.Write(ListBox1.Items(ii).ToString)
outputFile.WriteLine(1)
' *********************************TAG CODE ***********************************************
Console.WriteLine(GetInfo)
' *********************************TAG CODE ***********************************************
ii += 1
End While
outputFile.WriteLine("Document gathering complete." & DateAndTime.Today & DateAndTime.TimeOfDay)
outputFile.Close()
Next
End If
'Cleanup...
listing = Nothing
lfSearch = Nothing
settings = Nothing
searchResults = Nothing
mySession.Close()
mySession = Nothing
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try