Skip to content

Connection String

In order to use Enesys SharePoint Query , the first thing you need to do is to enter some connection string.

Usually, the Connection String will look like this:

server=http://your-sharepoint-server

But there are other options that you may need. Note that each option must be separated with a “;”.

The server option specifies the URL of the SharePoint server that will be used. When specifying URLs inside the query, they will be relative to this URL.

In case you need to retrieve data from several SharePoint servers inside the same query, the server option may be left empty. In this case, the URLs inside the query must be absolute.

This option has one synonym named data source that can be used instead.

The authenticationMode option specifies the authentication that the specified Web Application uses.

The default value is Windows .

For retrieving data from a Forms based authentication server, you must set the authenticationMode option to Forms .

For more information, please see your product documentation.

The enableObjectModel option specifies whether to use the Object Model if it is available when querying the SharePoint data.

The default value is true .

The convertBool option determines whether the SharePoint Booleans should be kept as Booleans or not.

For historical reason, this option’s default value is false , and Booleans are returned as integer values (0=false, 1=true).

The timeout option allows you to specify the timeout (in milliseconds) to use when querying the data using the Web Services. The default value is 300000 (5 minutes).

The following sample shows how to set the timeout to 1 minute (60,000ms)

data source=http://your-sharepoint-server;timeout=60000;

The retryTime option represents the time (in milliseconds) to wait before retrying to call the Web Services when a SharePoint timeout occurred. This option may be useful when your query stresses the SharePoint server.

The default value is 0 , meaning that no retry will be attempted.

The sleepTime option represents the time (in milliseconds) to wait between two calls to the Web Services. This option may be useful when your query stresses the SharePoint server.

The default value is 0 .

The data source variables are specific options which names are surrounded with “ $ ” and “ ! ”.

They can be used to specify the relative URL of a site ( relativeSiteUrl attribute), the list title ( title attribute) or parts of the sqlQuery connection string.

The idea behind this feature is that you can have a complete set of reports that rely on a variable rather than on the literal relative site URL. If you need to run your reports on another server that would not use the same site hierarchy, you just have to use another data source with the variable properly configured for your different server, without having to change the various URL in each statement and in each report.

The following connection string creates two data source variables:

server=http://sharepoint;$url!=/sites/ersdedemo/;$title!=Products

And the following sample shows how they can be used inside your query:

<list title="$title!" relativeSiteUrl="$url!" tableName="MyList">
<fields>...</fields>
<query>...</query>
</list>

You can also use it inside the sqlData connection string. With the following connection string

server=http://sharepoint;$sqlConnString!='data source=MySqlServer;User ID=MyUser;Password=MyPassword'

(Notice the use of quotes (’) to surround the SQL connection string, as it contains characters such as “=” or “;” which are forbidden inside an option value).

<sqlData tableName="SqlData">
<providerName>System.Data.SqlClient</providerName>
<connectionString>$sqlConnString!</connectionString>
<commandText>SELECT ... </commandText>
</sqlData>