Microsoft Office Tutorials and References
In Depth Information
Web Service API Methods
string xlWorkbookPath = @”http://theexcelserver/testsite/shared
documents/book1.xlsx”;
string uiCultureName = “en-US”;
string dataCultureName = “en-US”;
try
{
xlSessionId = xlEcsApi.OpenWorkbook(
xlWorkbookPath,
uiCultureName,
dataCultureName,
out xlStatus);
xlStatus = xlEcsApi.CloseWorkbook(xlSessionId);
}
catch (SoapException soapE)
{
Console.WriteLine(“Soap Fault {0}”, soapE.Message);
}
}
}
}
Local Linking
A second approach is to link the code directly to the web service assembly and call methods in-process
instead of using SOAP. For this approach to work, the web service calling code must have Windows
SharePoint Services (WSS) site context, which means the code runs within WSS.
The Excel web service assembly is located on MOSS servers at C:\Program Files\Common Files\
Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.Office.Excel.Server.WebServices.dll.
When you need to leverage local linking, simply add the project reference from the noted location.
In Microsoft Visual Studio 2005, the assembly is available as a reference on the .NET tab of the Add
Reference dialog box. If you want to use local linking, your project development environment must
be on a MOSS server.
Visual Studio shows different signatures for Excel web service methods depending on whether the
assembly was added as a web reference or as a reference (local linking). Any method with a void
return and an out parameter has a different signature. When you use the web reference, the out
parameter becomes the return. The API method explanations in this chapter present signatures as
web references.
An example solution that uses local linking for accessing the API is shown in the “Managed Code
Approach” section, later in this chapter.
Web Service API Methods
This section begins the coverage for each of the web service methods. For each method, a code sample is
shown that focuses strictly on the method being discussed. The code isn’t complete, but you can copy it
into the previous API solution and execute it. The in, out, and return parameters are explained, as well
as any intricacies for the methods.
Search JabSto ::




Custom Search