Microsoft Office Tutorials and References
In Depth Information
Web Service API Methods
Calling CancelRequest
You can make the following CancelRequest call when a sessionId is available after a successful
OpenWorkbook call:
string xlSessionId;
Status[] xlStatus;
xlSessionId = xlEcsApi.OpenWorkbook(
@”http://theexcelserver/testsite/Shared Documents/workbook.xlsb”,
out xlStatus);
xlStatus = xlEcsApi.CancelRequest(xlSessionId);
The Refresh method of the Excel Services web service requests updated query results for one or more
external data sources used by the workbook associated with the session. The declaration for the Refresh
method looks like this:
public Status[] Refresh(string sessionId, string connectionName)
Following are the parameters for this method:
sessionId (in) — The sessionId string that was returned from a prior OpenWorkbook call.
The session must still be active at the time of the Refresh call. Making a Refresh call using a
sessionId that has timed out results in a SOAP exception.
connectionName (in) — Use this string to specify one connection that is to be refreshed, or to
indicate that all connections in the workbook are to be refreshed. Specify the specific connection
name to refresh a single connection. Use values of String.Empty, null or “” to refresh all
workbook connections. Specifying a nonexistent connection name results in a Status return that
contains a message indicating that there was a problem refreshing the data.
Return Value
A status object is returned by default with a value of null. See the “Status Class” section, earlier in this
chapter, for an explanation of this return type.
Calling Refresh
The following example makes two Refresh calls. The first call refreshes all external data sources in the
workbook. The second call refreshes only the connection with a name of “oneSource”, if it exists in
the workbook.
Search JabSto ::

Custom Search