Microsoft Office Tutorials and References
In Depth Information
Figure 5-23. Adding a Service reference to access Excel Services over SOAP
7.
this action will discover and display the excelService service in Services section.
8.
Choose the excelService service, provide a valid name in the Namespace text box (Figure 5-23 ),
and click OK.
9.
right-click on references. From the add reference window, on the Framework tab (under
assemblies), choose System.Web.Services Component.
10.
Open the program.cs file, and add a reference to the namespaces as follows:
using ES_Soap.ExcelService; // ES_Soap is your console application project namespace
using System.Web.Services.Protocols;
11.
Declare variables and set values under the program class:
static string sheet = "Sheet1";
static string excelFilePath = "http://<site>/<doc lib>/<excelfile>.xlsx";
12.
add a static method called GetData , and copy and paste the following code in the method:
ExcelService.ExcelServiceSoapClient es = new ExcelService.ExcelServiceSoapClient();
es.ClientCredentials.Windows.AllowedImpersonationLevel =
System.Security.Principal.TokenImpersonationLevel.Impersonation;
Status[] status;
RangeCoordinates rangeCoordinates = new RangeCoordinates();
try
 
Search JabSto ::




Custom Search