I am working in VB.NET and using the DFS 65 SDK. I took the samples and created this code.If I add an additional attribute to the DQL query, the query service fails to execute I have treied this woth the C# example code also and I get the same results. The queries that I am trying work in a DFC based query tool or a dmcl based query tool.
I am at a loss as to why adding an attribute to the query causes the query execution to fail when I know that I have no syntax errors in the query and the query works in another tool.
Any ideas appreciated.
Thank you
*************************************************************************************************************************
Imports
System
Imports Emc.Documentum.FS.Services.Core
Imports Emc.Documentum.FS.DataModel.Core
Imports Emc.Documentum.FS.DataModel.Core.Query
Imports Emc.Documentum.FS.DataModel.Core.Properties
Imports Emc.Documentum.FS.Runtime
Imports Emc.Documentum.FS.Runtime.Context
Imports Emc.Documentum.FS.DataModel.Core.Context
Module Module1
'Namespace HelloDFS
'*
' * This class demonstrates how to code a typical request to a DFS core service(in
' * this case QueryService). The code goes through the steps of creating a
' * ServiceContext, which contains repository and credential information, creating
' * a profile, which contains properties that determine how a service operation
' * behaves, and calling the service with the profile.
' *
' * This sample assumes that you have a working installation
' * of DFS that points to a working Content Server.
' *
'
Class QueryServiceTest
'***********************************************************
' * You must supply valid values for the following fields:
' The repository that you want to run the query on
Private repository As [String] = "vision"
' The username to login to the repository
Private userName As [String] = "user"
' The password for the username
Private password As [String] = "Password"
' The address where the DFS services are located
Private address As [String] = "http://tr-desktop:8888/services"
'*********************************************************
' The module name for the DFS core services
Private Shared moduleName As [String] = "core"
Private serviceContext As IServiceContext
Public Sub setContext()
'
' * Get the service context and set the user
' * credentials and repository information
'
Dim contextFactory As ContextFactory = contextFactory.InstanceserviceContext = contextFactory.NewContext()
Dim repositoryIdentity As New RepositoryIdentity(repository, userName, password, "")serviceContext.AddIdentity(repositoryIdentity)
End Sub
'
' * Demonstrates a typical scenario for calling the query service.
' * Gets an instance of the Query service and calls the execute operation
' * with a hard-coded query and operation options.
'
Public Sub callQueryService()
'
' * Get an instance of the QueryService by passing
' * in the service context to the service factory.
'
Try
Dim serviceFactory As ServiceFactory = serviceFactory.Instance
Dim querySvc As IQueryService = serviceFactory.GetRemoteService(Of IQueryService)(serviceContext, moduleName, address)
'
' * Construct the query and the QueryExecution options
'
'Dim query As New PassthroughQuery()
Dim query As New PassthroughQuery()query.QueryString =
"select title, object_name " + "from dm_document where owner_name ='tommy'"
MsgBox(("QueryId == " + query.QueryString))query.AddRepository(repository)
Dim queryEx As New QueryExecution()queryEx.CacheStrategyType = CacheStrategyType.DEFAULT_CACHE_STRATEGY
'
' * Execute the query passing in the operation options and print the result
'
Dim operationOptions As OperationOptions = Nothing
Dim queryResult As QueryResult = querySvc.Execute(query, queryEx, operationOptions)
'Console.WriteLine("QueryId == " + query.QueryString)
' MsgBox(("QueryId == " + query.QueryString))
'Console.WriteLine("CacheStrategyType == " + queryEx.CacheStrategyType)
MsgBox(queryEx.CacheStrategyType)MsgBox(queryEx.MaxResultCount)Dim resultDp As DataPackage = queryResult.DataPackage
Dim dataObjects As List(Of DataObject) = resultDp.DataObjects
Dim numberOfObjects As Integer = dataObjects.Count
'Console.WriteLine("Total objects returned is: " + numberOfObjects)
MsgBox("Total object returned is " + CStr(numberOfObjects))
' For Each dObj As DataObject In dataObjects
'Dim docProperties As PropertySet = dObj.Properties
'Dim objectId As [String] = dObj.Identity.GetValueAsString()
'Dim docName As [String] = docProperties.[Get]("object_name").GetValueAsString()
'Dim owner_name As [String] = docProperties.[Get]("title").GetValueAsString()
'Console.WriteLine("Document " + objectId + " name is " + docName)
'MsgBox("Document " + objectId + " " + owner_name)
'Next
Catch e As ServiceException
'Console.WriteLine(e.Message)
MsgBox(e.Message)End Try
End Sub
Shared Sub Main(ByVal args As [String]())
Dim t As New QueryServiceTest()t.setContext()
t.callQueryService()
End Sub
End Class
'End Namespace
'
End Module
***************************************************************************************************************************