Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Regarding Search based on Date Properties

  Asked By: Kody    Date: Apr 08    Category: Sharepoint    Views: 1296

I have been able to execute search programmatically by
firing Queries with Ado.

However if i want to make a selection based on the
creation date the query fails.

for example to select the documents contributed on a
specific date the query wud be

Select "DAV:displayname" FROM SCOPE('SHALLOW TRAVERSAL
OF "/workspacename/Documents/foldername"')WHERE
"DAV:creationdate" = CAST("2002-08-17T05:21:56Z" as
'dateTime')

Am I making a mistake in forming the query?
Any idea about how to resolve the problem?

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Cecelia Gilliam     Answered On: Apr 08

I created a file share index within the content source section of
sharepoint. (The file share is on another machine). The index went well, and
searching through sharepoint's search  functionality works well also.

Now I am trying to connect via ADO, but am having no luck at all. My first
attempt was on an index created within the normal workspace. I could open
and close an ado  connection with the server, but any sql execution bombed
out. I also tried creating a dedicated search workspace on a different
machine. The sql statements didn't bomb, but the query  would run until the
web page timed out.

Code below represents some of my attempts in .net...

Dim strConnection, strSql As String
Dim objConnection As OleDbConnection
Dim objCommand As OleDbCommand
Dim objDataReader As OleDbDataReader

'trying to access sharepoint web storage below
'strSql = "SELECT size, ""DAV:href"" FROM SCOPE('DEEP TRAVERSAL OF
""/Search""')"
'strSql = "SELECT xxx FROM SCOPE() WHERE FREETEXT('day')"
strSql = "SELECT size, ""DAV:href"" FROM SCOPE(Search/quickdocs) WHERE
FREETEXT('massage')"
strConnection = "provider=msdaipp.dso; data
source=http://kmgexch/Search"
'strConnection = "provider=msdaipp.dso; data
source=http://kmasp1/sps_search"
objConnection = New OleDbConnection(strConnection)
objCommand = New OleDbCommand(strSql, objConnection)
objConnection.Open()
objDataReader = objCommand.ExecuteReader()
objConnection.Close()
Response.Write("ok")

Note: I also tried basic asp, using the example  posted on the microsoft site
and received the same results.

 
Answer #2    Answered By: Pramod Jituri     Answered On: Apr 08

Hope this helps a little:
'Create the ADO objects
Set conn = CreateObject("ADODB.Connection")
OnErrorExit "Error creating object: ADODB.Connection"
Set cmd = CreateObject("ADODB.Command")
OnErrorExit "Error creating object: ADODB.Command"
Set RS = CreateObject("ADODB.RecordSet")
OnErrorExit "Error creating object: ADODB.Recordset"

'connect to the SPS server
conn.ConnectionString = "provider=msdaipp.dso"
conn.CommandTimeout = 0
conn.Open Application("WHATEVER THE NAME OF THE WORKSPACE IS") 'IE
http ://kmasp1/My workspace
OnErrorExit "Error opening connection"

'associate the command object with the just opened connection
set cmd.ActiveConnection = conn

'execute the query
cmd.CommandText = sQueryText
RS.open cmd
OnErrorExit "Error executing query"

 
Didn't find what you were looking for? Find more on Regarding Search based on Date Properties Or get search suggestion and latest updates.




Tagged: