From d3b1fe5b32460296745995fd9a8011cdbaf834cc Mon Sep 17 00:00:00 2001 From: "Ashlesha Pawar (Tata Consultancy Services Limited)" Date: Fri, 22 May 2026 16:07:58 +0530 Subject: [PATCH 1/7] docs: fix typos, deprecation notes, dead links, and formatting cleanup --- ...ervice-for-use-as-a-bcs-external-system.md | 526 +++++++----------- ...-deploy-a-claims-provider-in-sharepoint.md | 49 +- ...to-get-an-entire-workbook-or-a-snapshot.md | 97 +--- .../how-to-get-values-from-ranges.md | 64 +-- .../how-to-set-values-of-ranges.md | 103 ++-- 5 files changed, 289 insertions(+), 550 deletions(-) diff --git a/docs/general-development/how-to-create-an-odata-data-service-for-use-as-a-bcs-external-system.md b/docs/general-development/how-to-create-an-odata-data-service-for-use-as-a-bcs-external-system.md index 5390981a8a..c874b3b82c 100644 --- a/docs/general-development/how-to-create-an-odata-data-service-for-use-as-a-bcs-external-system.md +++ b/docs/general-development/how-to-create-an-odata-data-service-for-use-as-a-bcs-external-system.md @@ -1,322 +1,204 @@ ---- -title: Create an OData data service for use as a BCS external system -description: Learn how to create an Internet-addressable WCF service that uses OData to send notifications to SharePoint when the underlying data changes. These notifications are used to trigger events that are attached to external lists. -ms.date: 09/25/2017 -ms.assetid: 7d7b3aa6-85b7-400d-8ea5-50bebac56a1d -ms.localizationpriority: medium ---- - - -# Create an OData data service for use as a BCS external system - -Learn how to create an Internet-addressable WCF service that uses OData to send notifications to SharePoint when the underlying data changes. These notifications are used to trigger events that are attached to external lists. - -This article describes how to create an ASP.NET Windows Communication Foundation (WCF) Data Service to expose the AdventureWorks 2012 LT sample database. This enables you to access the data through the Open Data protocol (OData). When access is established through OData, you can configure a Business Connectivity Services (BCS) external content type that will enable SharePoint to consume the data from the external database. To further enhance this OData source, you can add service contracts to the WCF service that will enable BCS to subscribe to notifications that indicate that the external data has changed. - - - - - -## Prerequisites for creating the OData service - - -The following are required to create the OData service in this article: - - - - -- A server hosting Internet Information Services (IIS) - - -- .NET Framework 3.5 or later - - -- SharePoint - - -- [AdventureWorks 2012 LT script](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks) - - -- [AdventureWorks 2012 LT Data](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks) - - -- Visual Studio 2012 - - -- Office Developer Tools for Visual Studio 2012 - - -For information about setting up your development environment, see [Set up a general development environment for SharePoint](set-up-a-general-development-environment-for-sharepoint.md). - - - - -### Core concepts for creating an OData service - -Table 1 lists articles that will help you understand the core concepts of building a WCF service using OData and external content. - - - - -**Table 1. Core concepts for creating an OData service** - - -|**Resource**|**Description**| -|:-----|:-----| -| [Using OData sources with Business Connectivity Services in SharePoint](using-odata-sources-with-business-connectivity-services-in-sharepoint.md)
|Provides information to help you start creating external content types based on OData sources and using that data in SharePoint or Office 2013 components.
| -| [How to: Create an external content type from an OData source in SharePoint](how-to-create-an-external-content-type-from-an-odata-source-in-sharepoint.md)
|Learn how to use Visual Studio 2012 to discover a published OData source and create a reusable external content type to use in BCS in SharePoint.
| -| [Open Data Protocol](http://www.odata.org)
|Provides information about the Open Data protocol, including protocol definitions, architectural information and usage examples.
| -| [WCF Data Services Overview](https://msdn.microsoft.com/library/cc668794.aspx)
|WCF Data Services enables creation and consumption of data services for the web or an intranet by using OData. OData enables you to expose your data as resources that are addressable by URIs.
| -| [Developing and Deploying WCF Data Services](https://msdn.microsoft.com/library/gg258442)
|Provides information about developing and deploying WCF Data Services.
| - - -### Steps involved in creating the external system - -The following steps will need to be completed - - - - -- Install the AdventureWorks 2012 LT sample database - - -- Create the OData Service - - -- Set access permissions - - -- Test the service - - -- Add capabilities for additional BCS functionality - - - -## Installing the sample database - - -An external system is usually a database and for that reason, this example shows how to use the AdventureWorks 2012 LT sample database to represent a proprietary datasource. - - - -The following steps will - - - - -## How to create the WCF OData service - - -Creating a Windows Communication Foundation (WCF) service that can be accessed through the OData protocol is relatively straightforward. Visual Studio 2012 provides several tools for automatically discovering and modeling the data from various data sources. This allows you to create connections and interfaces to data in SQL Server databases and other types of data stores that can then be worked with programmatically using an extensive object model. - - - -However, for SharePoint to enable BCS to receive notifications from remote systems when the underlying data has changed, you must modify the WCF service to respond to those changes. - - - - -### To create a new WCF project - - -1. In Visual Studio, on the **File** menu, choose **New**, **Project**. - - -2. In the **New Project** dialog box, choose the **Web** template, and then choose **ASP.NET Web Application**. - - -3. Enter **AdventureWorksService** for the project name, and choose **OK**. - - -4. In **Solution Explorer**, open the shortcut menu for the ASP.NET project that you just created, and choose **Properties**. - - -5. Select the **Web** tab, and set the value of the **Specific port** text box to8008. - - - -### To define the data model - - -1. In **Solution Explorer**, open the shortcut menu for the ASP.NET project, and choose **Add New Item**. - - -2. In the **Add New Item** dialog box, choose the Data template, and then choose **ADO.NET Entity Data Model**. - - -3. For the name of the data model, enter **AdventureWorks.edmx**. - - -4. In the **Entity Data Model Wizard**, choose **Generate from Database**, and then choose **Next**. - - -5. Connect the data model to the database by doing one of the following steps, and then choose **Next**. - - - If you do not have a database connection already configured, choose **New Connection**, and create a new connection. - - - - If you have a database connection already configured to connect to the Northwind database, choose that connection in the list of connections. - - - - On the final page of the wizard, select the check boxes for all tables in the database, and clear the check boxes for views and stored procedures. - - -6. Choose **Finish** to close the wizard. - - - -### To create the data service - - -1. In **Solution Explorer**, open the shortcut menu for your ASP.NET project, and then choose **Add New Item**. - - -2. In the **Add New Item** dialog box, choose **WCF Data Service**. - - -3. For the name of the service, enter **AdventureWorks**. - - Visual Studio creates the XML markup and code files for the new service. By default, the code-editor window opens. In **Solution Explorer**, the service will have the name, **AdventureWorks**, with the extension .svc.cs or .svc.vb. - - -4. Replace the comment `/* TODO: put your data source class name here */` in the definition of the class that defines the data service with the type that is the entity container of the data model, which in this case is **AdventureWorksEntities**. The class definition should look like the following: - -```csharp - -public class AdventureWorks : DataService -``` - -By default, when a WCF service is created, it cannot be accessed due to its security configuration. The next step lets you specify who can access it, and what rights they have. - - - - -### To enable access to data service resources - - -- In the code for the data service, replace the placeholder code in the **InitializeService** function with the following. - -```csharp -config.SetEntitySetAccessRule("*", EntitySetRights.All); -config.SetServiceOperationAccessRule("*", ServiceOperationRights.All); -``` -This enables authorized clients to have read and write access to resources for the specified entity sets. - - -> [!NOTE] -> Any client that can access the ASP.NET application can also access the resources that are exposed by the data service. In a production data service, to prevent unauthorized access to resources, you should also secure the application itself. For more information, see [Securing WCF Data Services](https://msdn.microsoft.com/library/dd728284.aspx). - -For BCS to receive notifications, there must be a mechanism on the back-end data source that will accept a request to be added and removed from notification subscriptions. - - - -The last step in creating the service is to add service operations for the **Subscribe** and **Unsubscribe** stereotypes that are defined in the BDC model. - - - - -### To add service operations for Subscribe and Unsubscribe stereotypes - - -- In the AdventureWorks.cs page, add the following string variable declaration. - -```csharp -public string subscriptionStorePath = @"\\\\[SHARE_NAME]\\SubscriptionStore\\SubscriptionStore.xml"; -``` - -> [!NOTE] -> This file is an XML file that is updated with the new subscriptions. Access to this file will be made by the server process, so make sure you have granted sufficient rights for this file access. > You might also want to create a database solution for storing subscription information. - -Then add the following two **WebGet** methods to handle the subscriptions. - -```csharp -[WebGet] -public string Subscribe(string deliveryUrl, string eventType) -{ - string subscriptionId = Guid.NewGuid().ToString(); - - XmlDocument subscriptionStore = new XmlDocument(); - - subscriptionStore.Load(subscriptionStorePath); - - // Add a new subscription element. - XmlNode newSubNode = subscriptionStore.CreateElement("Subscription"); - - // Add subscription ID element to the subscription element. - XmlNode subscriptionIdStart = subscriptionStore.CreateElement("SubscriptionID"); - subscriptionIdStart.InnerText = subscriptionId; - newSubNode.AppendChild(subscriptionIdStart); - - // Add delivery URL element to the subscription element. - XmlNode deliveryAddressStart = subscriptionStore.CreateElement("DeliveryAddress"); - deliveryAddressStart.InnerText = deliveryUrl; - newSubNode.AppendChild(deliveryAddressStart); - - // Add event type element to the subscription element. - XmlNode eventTypeStart = subscriptionStore.CreateElement("EventType"); - eventTypeStart.InnerText = eventType; - newSubNode.AppendChild(eventTypeStart); - - // Add the subscription element to the root element. - subscriptionStore.AppendChild(newSubNode); - - subscriptionStore.Save(subscriptionStorePath); - - return subscriptionId; -} - -[WebGet] -public void Unsubscribe(string subscriptionId) -{ - XmlDocument subscriptionStore = new XmlDocument(); - subscriptionStore.Load(subscriptionStorePath); - - XmlNodeList subscriptions = subscriptionStore.DocumentElement.ChildNodes; - foreach (XmlNode subscription in subscriptions) - { - XmlNodeList subscriptionList = subscription.ChildNodes; - if (subscriptionList.Item(0).InnerText == subscriptionId) - { - subscriptionStore.DocumentElement.RemoveChild(subscription); - break; - } - } - - subscriptionStore.Save(subscriptionStorePath); -} - -``` - - -## Next steps - - -To notify SharePoint that changes have been made, you also need to create a service that queries the data source for changes, and then sends notifications to all those subscribed to notifications. - - - - -## See also - - - -- [Business Connectivity Services in SharePoint](business-connectivity-services-in-sharepoint.md) - - -- [Using OData sources with Business Connectivity Services in SharePoint](using-odata-sources-with-business-connectivity-services-in-sharepoint.md) - - -- [External content types in SharePoint](external-content-types-in-sharepoint.md) - - -- [External events and alerts in SharePoint](external-events-and-alerts-in-sharepoint.md) - - -- [How to: Create an external content type from an OData source in SharePoint](how-to-create-an-external-content-type-from-an-odata-source-in-sharepoint.md) - - -- [Business Connectivity Services programmers reference for SharePoint](business-connectivity-services-programmers-reference-for-sharepoint.md) - - - +--- +title: Create an OData data service for use as a BCS external system +description: Learn how to create an Internet-addressable WCF service that uses OData to send notifications to SharePoint when the underlying data changes. These notifications are used to trigger events that are attached to external lists. +ms.date: 09/25/2017 +ms.assetid: 7d7b3aa6-85b7-400d-8ea5-50bebac56a1d +ms.localizationpriority: medium +--- + +# Create an OData data service for use as a BCS external system + +Learn how to create an Internet-addressable WCF service that uses OData to send notifications to SharePoint when the underlying data changes. These notifications are used to trigger events that are attached to external lists. + +This article describes how to create an ASP.NET Windows Communication Foundation (WCF) Data Service to expose the AdventureWorks 2012 LT sample database. This enables you to access the data through the Open Data protocol (OData). When access is established through OData, you can configure a Business Connectivity Services (BCS) external content type that will enable SharePoint to consume the data from the external database. To further enhance this OData source, you can add service contracts to the WCF service that will enable BCS to subscribe to notifications that indicate that the external data has changed. + +## Prerequisites for creating the OData service + + +The following are required to create the OData service in this article: + +- A server hosting Internet Information Services (IIS) +- .NET Framework 4.7.2 or later +- SharePoint +- [AdventureWorks 2012 LT script](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks) +- [AdventureWorks 2012 LT Data](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks) +- Visual Studio 2022 +- Office Developer Tools for Visual Studio 2022 + +For information about setting up your development environment, see [Set up a general development environment for SharePoint](set-up-a-general-development-environment-for-sharepoint.md). + +### Core concepts for creating an OData service + +Table 1 lists articles that will help you understand the core concepts of building a WCF service using OData and external content. + +**Table 1. Core concepts for creating an OData service** + +|**Resource**|**Description**| +|:-----|:-----| +| [Using OData sources with Business Connectivity Services in SharePoint](using-odata-sources-with-business-connectivity-services-in-sharepoint.md) | Provides information to help you start creating external content types based on OData sources and using that data in SharePoint or Microsoft 365 components. | +| [How to: Create an external content type from an OData source in SharePoint](how-to-create-an-external-content-type-from-an-odata-source-in-sharepoint.md) | Learn how to use Visual Studio 2022 to discover a published OData source and create a reusable external content type to use in BCS in SharePoint. | +| [Open Data Protocol](https://www.odata.org) | Provides information about the Open Data protocol, including protocol definitions, architectural information, and usage examples. | +| [WCF Data Services Overview](/previous-versions/dotnet/framework/data/wcf/wcf-data-services-overview) | WCF Data Services enables creation and consumption of data services for the web or an intranet by using OData. OData enables you to expose your data as resources that are addressable by URIs. | +| [Developing and Deploying WCF Data Services](/previous-versions/dotnet/framework/data/wcf/developing-and-deploying-wcf-data-services) | Provides information about developing and deploying WCF Data Services. | + +### Steps involved in creating the external system + +The following steps need to be completed: + +- Install the AdventureWorks 2012 LT sample database +- Create the OData Service +- Set access permissions +- Test the service +- Add capabilities for additional BCS functionality + +## Installing the sample database + + +An external system is usually a database, and for that reason, this example shows how to use the AdventureWorks 2012 LT sample database to represent a proprietary data source. + +## How to create the WCF OData service + + +Creating a Windows Communication Foundation (WCF) service that can be accessed through the OData protocol is relatively straightforward. Visual Studio 2022 provides several tools for automatically discovering and modeling the data from various data sources. This allows you to create connections and interfaces to data in SQL Server databases and other types of data stores that can then be worked with programmatically using an extensive object model. + +However, for SharePoint to enable BCS to receive notifications from remote systems when the underlying data has changed, you must modify the WCF service to respond to those changes. + +### To create a new WCF project + +1. In Visual Studio, on the **File** menu, choose **New**, **Project**. +2. In the **New Project** dialog box, choose the **Web** template, and then choose **ASP.NET Web Application**. +3. Enter **AdventureWorksService** for the project name, and choose **OK**. +4. In **Solution Explorer**, open the shortcut menu for the ASP.NET project that you just created, and choose **Properties**. +5. Select the **Web** tab, and set the value of the **Specific port** text box to **8008**. + +### To define the data model + +1. In **Solution Explorer**, open the shortcut menu for the ASP.NET project, and choose **Add New Item**. +2. In the **Add New Item** dialog box, choose the Data template, and then choose **ADO.NET Entity Data Model**. +3. For the name of the data model, enter **AdventureWorks.edmx**. +4. In the **Entity Data Model Wizard**, choose **Generate from Database**, and then choose **Next**. +5. Connect the data model to the database by doing one of the following steps, and then choose **Next**. + - If you do not have a database connection already configured, choose **New Connection**, and create a new connection. + - If you have a database connection already configured to connect to the Northwind database, choose that connection in the list of connections. + - On the final page of the wizard, select the check boxes for all tables in the database, and clear the check boxes for views and stored procedures. +6. Choose **Finish** to close the wizard. + +### To create the data service + +1. In **Solution Explorer**, open the shortcut menu for your ASP.NET project, and then choose **Add New Item**. +2. In the **Add New Item** dialog box, choose **WCF Data Service**. +3. For the name of the service, enter **AdventureWorks**. + + Visual Studio creates the XML markup and code files for the new service. By default, the code-editor window opens. In **Solution Explorer**, the service will have the name **AdventureWorks**, with the extension .svc.cs or .svc.vb. + +4. Replace the comment `/* TODO: put your data source class name here */` in the definition of the class that defines the data service with the type that is the entity container of the data model, which in this case is **AdventureWorksEntities**. The class definition should look like the following: + +```csharp +public class AdventureWorks : DataService +``` + +By default, when a WCF service is created, it cannot be accessed due to its security configuration. The next step lets you specify who can access it and what rights they have. + +### To enable access to data service resources + +- In the code for the data service, replace the placeholder code in the **InitializeService** function with the following. + +```csharp +config.SetEntitySetAccessRule("*", EntitySetRights.All); +config.SetServiceOperationAccessRule("*", ServiceOperationRights.All); +``` + +This enables authorized clients to have read and write access to resources for the specified entity sets. + +> [!NOTE] +> Any client that can access the ASP.NET application can also access the resources that are exposed by the data service. In a production data service, to prevent unauthorized access to resources, you should also secure the application itself. For more information, see [Securing WCF Data Services](/previous-versions/dotnet/framework/data/wcf/securing-wcf-data-services). + +For BCS to receive notifications, there must be a mechanism on the back-end data source that will accept a request to be added and removed from notification subscriptions. + +The last step in creating the service is to add service operations for the **Subscribe** and **Unsubscribe** stereotypes that are defined in the BDC model. + +### To add service operations for Subscribe and Unsubscribe stereotypes + +- In the AdventureWorks.cs page, add the following string variable declaration. + +```csharp +public string subscriptionStorePath = @"\\\\[SHARE_NAME]\\SubscriptionStore\\SubscriptionStore.xml"; +``` + +> [!NOTE] +> This file is an XML file that is updated with the new subscriptions. Access to this file will be made by the server process, so make sure you have granted sufficient rights for this file access. You might also want to create a database solution for storing subscription information. + +Then add the following two **WebGet** methods to handle the subscriptions. + +```csharp +[WebGet] +public string Subscribe(string deliveryUrl, string eventType) +{ + string subscriptionId = Guid.NewGuid().ToString(); + + XmlDocument subscriptionStore = new XmlDocument(); + + subscriptionStore.Load(subscriptionStorePath); + + // Add a new subscription element. + XmlNode newSubNode = subscriptionStore.CreateElement("Subscription"); + + // Add subscription ID element to the subscription element. + XmlNode subscriptionIdStart = subscriptionStore.CreateElement("SubscriptionID"); + subscriptionIdStart.InnerText = subscriptionId; + newSubNode.AppendChild(subscriptionIdStart); + + // Add delivery URL element to the subscription element. + XmlNode deliveryAddressStart = subscriptionStore.CreateElement("DeliveryAddress"); + deliveryAddressStart.InnerText = deliveryUrl; + newSubNode.AppendChild(deliveryAddressStart); + + // Add event type element to the subscription element. + XmlNode eventTypeStart = subscriptionStore.CreateElement("EventType"); + eventTypeStart.InnerText = eventType; + newSubNode.AppendChild(eventTypeStart); + + // Add the subscription element to the root element. + subscriptionStore.AppendChild(newSubNode); + + subscriptionStore.Save(subscriptionStorePath); + + return subscriptionId; +} + +[WebGet] +public void Unsubscribe(string subscriptionId) +{ + XmlDocument subscriptionStore = new XmlDocument(); + subscriptionStore.Load(subscriptionStorePath); + + XmlNodeList subscriptions = subscriptionStore.DocumentElement.ChildNodes; + foreach (XmlNode subscription in subscriptions) + { + XmlNodeList subscriptionList = subscription.ChildNodes; + if (subscriptionList.Item(0).InnerText == subscriptionId) + { + subscriptionStore.DocumentElement.RemoveChild(subscription); + break; + } + } + + subscriptionStore.Save(subscriptionStorePath); +} + +``` + +## Next steps + + +To notify SharePoint that changes have been made, you also need to create a service that queries the data source for changes, and then sends notifications to all those subscribed to notifications. + +## See also + + +- [Business Connectivity Services in SharePoint](business-connectivity-services-in-sharepoint.md) +- [Using OData sources with Business Connectivity Services in SharePoint](using-odata-sources-with-business-connectivity-services-in-sharepoint.md) +- [External content types in SharePoint](external-content-types-in-sharepoint.md) +- [External events and alerts in SharePoint](external-events-and-alerts-in-sharepoint.md) +- [How to: Create an external content type from an OData source in SharePoint](how-to-create-an-external-content-type-from-an-odata-source-in-sharepoint.md) +- [Business Connectivity Services programmers reference for SharePoint](business-connectivity-services-programmers-reference-for-sharepoint.md) \ No newline at end of file diff --git a/docs/general-development/how-to-deploy-a-claims-provider-in-sharepoint.md b/docs/general-development/how-to-deploy-a-claims-provider-in-sharepoint.md index 5f26e39011..c5c6b9679d 100644 --- a/docs/general-development/how-to-deploy-a-claims-provider-in-sharepoint.md +++ b/docs/general-development/how-to-deploy-a-claims-provider-in-sharepoint.md @@ -6,27 +6,20 @@ ms.assetid: 3a5fcedc-aa9a-4ff4-95c0-0e0a7dea9d1f ms.localizationpriority: medium --- - # Deploy a claims provider in SharePoint -Learn how to deploy a SharePoint claims provider by using the features infrastructure and creating a class that inherits from [SPClaimProviderFeatureReceiver](https://msdn.microsoft.com/library/Microsoft.SharePoint.Administration.Claims.SPClaimProviderFeatureReceiver.aspx) . +> [!IMPORTANT] +> This content applies to SharePoint Server on-premises only. Custom claims providers are not supported in SharePoint Online. -## Deploying a claims provider as part of a setup - +Learn how to deploy a SharePoint claims provider by using the features infrastructure and creating a class that inherits from [SPClaimProviderFeatureReceiver](/previous-versions/office/sharepoint-server/ee559827(v=office.15)). -The easiest way to deploy a claims provider is by using the features infrastructure. To do this, first define a Farm scoped feature and a feature receiver that derives from the [SPClaimProviderFeatureReceiver](https://msdn.microsoft.com/library/Microsoft.SharePoint.Administration.Claims.SPClaimProviderFeatureReceiver.aspx) class, and override the base properties. - - - -The following is an example of how to do this. - - - +## Deploying a claims provider as part of a setup +The easiest way to deploy a claims provider is by using the features infrastructure. To do this, first define a Farm scoped feature and a feature receiver that derives from the [SPClaimProviderFeatureReceiver](/previous-versions/office/sharepoint-server/ee559827(v=office.15)) class, and override the base properties. +The following is an example of how to do this. ```csharp - public class MyClaimProviderFeatureReceiver : SPClaimProviderFeatureReceiver { public override string ClaimProviderAssembly { get { return typeof(MyClaimProvider).Assembly.FullName; } } @@ -50,15 +43,10 @@ public class MyClaimProviderFeatureReceiver : SPClaimProviderFeatureReceiver ## Deploying a claims provider using the feature infrastructure - -The following is a sample that demonstrates how to define a feature and a feature receiver that derives from [SPClaimProviderFeatureReceiver](https://msdn.microsoft.com/library/Microsoft.SharePoint.Administration.Claims.SPClaimProviderFeatureReceiver.aspx) and override the base properties. - - - +The following is a sample that demonstrates how to define a feature and a feature receiver that derives from [SPClaimProviderFeatureReceiver](/previous-versions/office/sharepoint-server/ee559827(v=office.15)) and override the base properties. ```csharp - // Sample claims provider feature receiver class through which // the sample claims provider registers itself // with the Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager class. @@ -139,10 +127,9 @@ namespace MySample.Sample.Server.SampleClaimsProvider } /// - /// This methods gets called after the activation of the feature. + /// This method gets called after the activation of the feature. /// - - /// Represents the properties of a feature activation<./param> + /// Represents the properties of a feature activation /// void. public override void FeatureActivated(Microsoft.SharePoint.SPFeatureReceiverProperties properties) { @@ -158,19 +145,9 @@ namespace MySample.Sample.Server.SampleClaimsProvider ## See also - - -- [Claims-based identity in SharePoint](claims-based-identity-in-sharepoint.md) - - -- [Incoming claims: Signing into SharePoint](incoming-claims-signing-into-sharepoint.md) - - -- [Claims provider in SharePoint](claims-provider-in-sharepoint.md) - - -- [How to: Create a claims provider in SharePoint](how-to-create-a-claims-provider-in-sharepoint.md) - - +- [Claims-based identity in SharePoint](claims-based-identity-in-sharepoint.md) +- [Incoming claims: Signing into SharePoint](incoming-claims-signing-into-sharepoint.md) +- [Claims provider in SharePoint](claims-provider-in-sharepoint.md) +- [How to: Create a claims provider in SharePoint](how-to-create-a-claims-provider-in-sharepoint.md) diff --git a/docs/general-development/how-to-get-an-entire-workbook-or-a-snapshot.md b/docs/general-development/how-to-get-an-entire-workbook-or-a-snapshot.md index a09b638b05..bd3cc91224 100644 --- a/docs/general-development/how-to-get-an-entire-workbook-or-a-snapshot.md +++ b/docs/general-development/how-to-get-an-entire-workbook-or-a-snapshot.md @@ -9,71 +9,53 @@ ms.assetid: 39115503-8352-4589-87f4-cfa9c07260b6 ms.localizationpriority: medium --- - # Get an entire workbook or a snapshot -This example shows how to get an entire workbook, a snapshot of the entire file, or just a snapshot of the viewable sheets or objects in the file by using Excel Web Services. Getting the workbook or a snapshot is useful if you want to save a copy of the up-to-date workbook, store it somewhere, send it to someone, and so on. - - +> [!IMPORTANT] +> Excel Web Services (SOAP API) is deprecated. For new development targeting SharePoint Online or modern SharePoint environments, use the [Microsoft Graph Excel REST API](/graph/api/resources/excel) instead. +This example shows how to get an entire workbook, a snapshot of the entire file, or just a snapshot of the viewable sheets or objects in the file by using Excel Web Services. Getting the workbook or a snapshot is useful if you want to save a copy of the up-to-date workbook, store it somewhere, send it to someone, and so on. A snapshot is a workbook generated by Excel Calculation Services, and it represents the current state of the workbook in the Excel Services session. Some snapshots (known as "published item snapshots") contain only those portions of the Excel file that an author selects as viewable when saving the file to the server. Snapshots contain the layout and formats of the original file, and up-to-date values calculated by Excel Calculation Services, but they do not contain Excel formulas or external data connections. Excel Services opens the Excel file on the server, refreshes data sources, and calculates all Excel formulas. When a user or application requests a snapshot, Excel Services then generates and sends a snapshot back through the Web service API. -You can acquire a snapshot of a workbook you already saved to the server, even if you do not have the rights to access the actual file on the server. - - +You can acquire a snapshot of a workbook you already saved to the server, even if you do not have the rights to access the actual file on the server. You use the Web service's **GetWorkbook** method to get either the entire workbook or one of the snapshot types. For example, the following code returns a snapshot of the entire Excel workbook. It uses the **WorkbookType.FullSnapshot** enumeration as the second argument in the **GetWorkbook** method. - ```csharp - byte[] workbook = xlService.GetWorkbook(sessionId, WorkbookType.FullSnapshot, out status); ``` - - - ```VB.net Dim workbook() As Byte = xlService.GetWorkbook(sessionId, WorkbookType.FullSnapshot, status) ``` -The **GetWorkbook** method returns a byte array, in the same Excel file format as the one loaded into the session.To get a snapshot of the items that the Excel workbook author selected as viewable when saving the workbook from Excel to the server, use the **WorkbookType.PublishedItemsSnapshot** enumeration as shown here: - +The **GetWorkbook** method returns a byte array, in the same Excel file format as the one loaded into the session. To get a snapshot of the items that the Excel workbook author selected as viewable when saving the workbook from Excel to the server, use the **WorkbookType.PublishedItemsSnapshot** enumeration as shown here: ```csharp byte[] workbook = xlService.GetWorkbook(sessionId, WorkbookType.PublishedItemsSnapshot, out status); ``` - - - ```VB.net -Dim workbook() As Byte = xlService.GetWorkbook(sessionId, WorkbookType.FullSnapshot, status) +Dim workbook() As Byte = xlService.GetWorkbook(sessionId, WorkbookType.PublishedItemsSnapshot, status) ``` To get a snapshot of the entire workbook in its current session state, use the **WorkbookType.FullWorkbook** enumeration: - ```csharp byte[] workbook = xlService.GetWorkbook(sessionId, WorkbookType.FullWorkbook, out status); ``` - - - ```VB.net Dim workbook() As Byte = xlService.GetWorkbook(sessionId, WorkbookType.FullWorkbook, status) ``` -The **WorkbookType.FullWorkbook** option works only if the user has open rights to the file; if the user has view-only rights, the call will fail.In some cases, your code would need to save the result of a **GetWorkbook** call. For a discussion about how to save a workbook, see the [How to: Save a Workbook](https://msdn.microsoft.com/library/feb74f7a-2d8f-4672-911b-de85f8852aea%28Office.15%29.aspx) example.For more information about the **GetWorkbook** method and the **WorkbookType** enumeration, see the Excel Web Services reference documentation. +The **WorkbookType.FullWorkbook** option works only if the user has open rights to the file; if the user has view-only rights, the call will fail. In some cases, your code would need to save the result of a **GetWorkbook** call. For a discussion about how to save a workbook, see the [How to: Save a Workbook](/previous-versions/office/developer/sharepoint-2007/ms575918(v=office.12)) example. For more information about the **GetWorkbook** method and the **WorkbookType** enumeration, see the Excel Web Services reference documentation. + ## Example The following program (a console application) receives one command-line argument, which is the path to the workbook on the server. The program calls the Web service to open the workbook on the server and get a snapshot. It then writes it to standard output so that you can redirect it to a new snapshot file. - - - ```csharp using System; using System.IO; @@ -138,14 +120,12 @@ namespace GetSnapshot } ``` - ```VB.net - Imports System Imports System.IO Imports System.Text Imports System.Web.Services.Protocols -' TODO: Change the using GetSnapshot.myServer02 statement +' TODO: Change the Imports GetSnapshot.myServer02 statement ' to point to the Web service you are referencing. Imports GetSnapshot.myServer02 @@ -171,8 +151,8 @@ Namespace GetSnapshot ' and close the session. Dim sessionId As String = xlService.OpenWorkbook(args(0), "en-US", "en-US", status) Dim workbook() As Byte = xlService.GetWorkbook(sessionId, WorkbookType.PublishedItemsSnapshot, status) - ' byte[] workbook = xlService.GetWorkbook(sessionId, WorkbookType.FullWorkbook, out status); - ' byte[] workbook = xlService.GetWorkbook(sessionId, WorkbookType.FullSnapshot, out status); + ' Dim workbook() As Byte = xlService.GetWorkbook(sessionId, WorkbookType.FullWorkbook, status) + ' Dim workbook() As Byte = xlService.GetWorkbook(sessionId, WorkbookType.FullSnapshot, status) ' Close the workbook. This also closes the session. status = xlService.CloseWorkbook(sessionId) @@ -196,23 +176,12 @@ End Namespace Use the following command line and arguments to run the GetSnapshot application: - - - - - ``` - GetSnapshot.exe [workbook_path] > [snapshot_filename] ``` For example: - - - - - ``` C:\\>GetSnapshot.exe http://myServer02/reports/reports/OriginalWorkbook.xlsx > SnapshotCopy.xlsx ``` @@ -220,56 +189,30 @@ C:\\>GetSnapshot.exe http://myServer02/reports/reports/OriginalWorkbook.xlsx > S If you use the previous command-line example, the GetSnapshot tool places a new file in the "C:\\" directory. > [!NOTE] -> he workbook that you want to get a snapshot of must be in a trusted location. - - - - +> The workbook that you want to get a snapshot of must be in a trusted location. ## Robust programming -Make sure you add a Web reference to an Excel Web Services site you have access to. Change the `using GetSnapshot.myServer02;` statement to point to the Web service site you are referencing. - - - +Make sure you add a Web reference to an Excel Web Services site you have access to. Change the `using GetSnapshot.myServer02;` statement to point to the Web service site you are referencing. ## See also - #### Tasks +[How to: Trust a Location](how-to-trust-a-location.md) - - - - [How to: Trust a Location](how-to-trust-a-location.md) #### Concepts +[Accessing the SOAP API](accessing-the-soap-api.md) - - - - [Accessing the SOAP API](accessing-the-soap-api.md) #### Other resources +[Step 1: Creating the Web Service Client Project](step-1-creating-the-web-service-client-project.md) +[Step 2: Adding a Web Reference](step-2-adding-a-web-reference.md) +[Step 3: Accessing the Web Service](step-3-accessing-the-web-service.md) +[Step 4: Building and Testing the Application](step-4-building-and-testing-the-application.md) - [Step 1: Creating the Web Service Client Project](step-1-creating-the-web-service-client-project.md) - - - - [Step 2: Adding a Web Reference](step-2-adding-a-web-reference.md) - - - - [Step 3: Accessing the Web Service](step-3-accessing-the-web-service.md) - - - - [Step 4: Building and Testing the Application](step-4-building-and-testing-the-application.md) - - - - [Walkthrough: Developing a Custom Application Using Excel Web Services](walkthrough-developing-a-custom-application-using-excel-web-services.md) +[Walkthrough: Developing a Custom Application Using Excel Web Services](walkthrough-developing-a-custom-application-using-excel-web-services.md) diff --git a/docs/general-development/how-to-get-values-from-ranges.md b/docs/general-development/how-to-get-values-from-ranges.md index 83b3eb4a9c..797e9eaafe 100644 --- a/docs/general-development/how-to-get-values-from-ranges.md +++ b/docs/general-development/how-to-get-values-from-ranges.md @@ -12,19 +12,16 @@ ms.localizationpriority: high # Get values from ranges -Excel Web Services exposes four methods for getting values from an Excel workbook: **GetCell**, **GetCellA1**, **GetRange**, and **GetRangeA1**. - - - +> [!IMPORTANT] +> Excel Web Services and SharePoint SOAP-based Excel Services APIs are legacy technologies and are no longer under active development. Existing solutions may continue to work, but Microsoft recommends using newer Microsoft 365 APIs and Office Scripts solutions for new development where applicable. + +Excel Web Services exposes four methods for getting values from an Excel workbook: **GetCell**, **GetCellA1**, **GetRange**, and **GetRangeA1**. The **GetCell** and **GetCellA1** methods return the value of a single cell. If you try to request more than a single cell—for example, by passing in a range reference such as "B1:E2" or a named range that is larger than a single cell, and so on—your method call will fail. If you want to retrieve values from a range of cells, use the **GetRange** and **GetRangeA1** methods instead. -Methods that have the A1 suffix ( **GetCellA1** and **GetRangeA1**) use a different coordinate system than those that do not ( **GetCell** and **GetRange**). If you want to use Excel-style references to cells, such as range references (for example, H8, A3:D5, Sheet2!A12:G18) or named ranges, you should use the methods with the A1 suffix. Those methods allow you to pass in the name of a sheet and the range address you want. In most cases, it is a good idea to use named ranges rather than Excel-style references, for abstraction reasons. - - - -If you want to access an Excel range by using a numeric coordinate system, you should use the methods that do not have the A1 suffix. It is easier to use range coordinates when you have code that iterates through a set of cells in a loop, or when the range coordinates are calculated dynamically as part of the algorithm.The row and column coordinates of a cell are 0-based. Therefore, "0,0" will return cell A1, as in this example: +Methods that have the A1 suffix ( **GetCellA1** and **GetRangeA1**) use a different coordinate system than those that do not ( **GetCell** and **GetRange**). If you want to use Excel-style references to cells, such as range references (for example, H8, A3:D5, Sheet2!A12:G18) or named ranges, you should use the methods with the A1 suffix. Those methods allow you to pass in the name of a sheet and the range address you want. In most cases, it is a good idea to use named ranges rather than Excel-style references, for abstraction reasons. +If you want to access an Excel range by using a numeric coordinate system, you should use the methods that do not have the A1 suffix. It is easier to use range coordinates when you have code that iterates through a set of cells in a loop, or when the range coordinates are calculated dynamically as part of the algorithm. The row and column coordinates of a cell are 0-based. Therefore, "0,0" will return cell A1, as in this example: ```csharp @@ -34,16 +31,15 @@ object[] rangeResult2 = xlservice.GetCell(sessionId, sheetName, 0, 0, true, out ``` - - -```VB.net +```vb ' Call the GetCell method to retrieve a value from a cell. ' The cell is in the first row and first column; that is, cell A1 Dim rangeResult2() As Object = xlservice.GetCell(sessionId, sheetName, 0, 0, True, outStatus) ``` -If you are getting values from multiple adjacent cells, you may want to consider using the **GetRange** method instead of making multiple calls to the **GetCell** method. This results in a single roundtrip to the server instead of multiple roundtrips. Therefore, in some cases, you may gain a noticeable performance improvement by using the **GetRange** method instead of the **GetCell** method.When getting a range of cells using the **GetRange** and **GetRangeA1** methods, you get back an object array ( **object[]** in C# and **Object ()** in Visual Basic .NET). The object array is actually a jagged array. Each entry in the array you get back will be another array of objects representing the cells. For more information about jagged arrays, see [Jagged Arrays (C# Programming Guide)](https://msdn.microsoft.com/library/2s05feca.aspx) (https://msdn.microsoft.com/library/2s05feca.aspx). +If you are getting values from multiple adjacent cells, you may want to consider using the **GetRange** method instead of making multiple calls to the **GetCell** method. This results in a single roundtrip to the server instead of multiple roundtrips. Therefore, in some cases, you may gain a noticeable performance improvement by using the **GetRange** method instead of the **GetCell** method. When getting a range of cells using the **GetRange** and **GetRangeA1** methods, you get back an object array ( **object[]** in C# and **Object ()** in Visual Basic .NET). The object array is actually a jagged array. Each entry in the array you get back will be another array of objects representing the cells. For more information about jagged arrays, see [Jagged Arrays (C# Programming Guide)](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/arrays#jagged-arrays). + ### To get values using the GetCell and GetRange methods @@ -58,7 +54,7 @@ string sheetName = "Sheet2"; // Set the path to a workbook. // The workbook must be in a trusted location. -string targetWorkbookPath = "http://myserver02/example/Shared%20Documents/Book1.xlsx"; +string targetWorkbookPath = "https://myserver02/example/Shared%20Documents/Book1.xlsx"; // Set credentials for requests. xlservice.Credentials = System.Net.CredentialCache.DefaultCredentials; @@ -73,7 +69,7 @@ object[] rangeResult2 = xlservice.GetCell(sessionId, sheetName, 0, 8, false, out ``` -```VB.net +```vb ' Instantiate the Web service and make a status array object. Dim xlservice As New ExcelService() @@ -82,7 +78,7 @@ Dim sheetName As String = "Sheet2" ' Set the path to a workbook. ' The workbook must be in a trusted location. -Dim targetWorkbookPath As String = "http://myserver02/example/Shared%20Documents/Book1.xlsx" +Dim targetWorkbookPath As String = "https://myserver02/example/Shared%20Documents/Book1.xlsx" ' Set credentials for requests. xlservice.Credentials = System.Net.CredentialCache.DefaultCredentials @@ -126,7 +122,7 @@ foreach (object[] x in rangeResult1s) ``` -```VB.net +```vb ' Instantiate the Web service and make a status array object. Dim xlservice As New ExcelService() @@ -168,7 +164,7 @@ object[] rangeResult = xlservice.GetCellA1(sessionId, sheetName, "MonthlyPayment ``` -```VB.net +```vb ' Instantiate the Web service and make a status array object. Dim xlservice As New ExcelService() @@ -213,7 +209,7 @@ foreach (object[] rangeResult in rangeResults) ``` -```VB.net +```vb Dim rangeResults() As Object = xlservice.GetRangeA1(sessionId, "Sheet1", "B2:D3", True, outStatus) For Each rangeResult As Object() In rangeResults @@ -224,29 +220,7 @@ Next rangeResult ## See also - -#### Tasks - - - - - - [How to: Specify a Range Address and Sheet Name](how-to-specify-a-range-address-and-sheet-name.md) - - - - [How to: Set Values of Ranges](how-to-set-values-of-ranges.md) -#### Concepts - - - - - - [Accessing the SOAP API](accessing-the-soap-api.md) -#### Other resources - - - - - - [Walkthrough: Developing a Custom Application Using Excel Web Services](walkthrough-developing-a-custom-application-using-excel-web-services.md) +- [How to: Specify a Range Address and Sheet Name](how-to-specify-a-range-address-and-sheet-name.md) +- [How to: Set Values of Ranges](how-to-set-values-of-ranges.md) +- [Accessing the SOAP API](accessing-the-soap-api.md) +- [Walkthrough: Developing a Custom Application Using Excel Web Services](walkthrough-developing-a-custom-application-using-excel-web-services.md) diff --git a/docs/general-development/how-to-set-values-of-ranges.md b/docs/general-development/how-to-set-values-of-ranges.md index 808e527e8d..04b0aea072 100644 --- a/docs/general-development/how-to-set-values-of-ranges.md +++ b/docs/general-development/how-to-set-values-of-ranges.md @@ -9,25 +9,20 @@ ms.assetid: ccc7e204-f857-45a9-81ec-3a8484e6d454 ms.localizationpriority: medium --- - # Set values of ranges +> [!IMPORTANT] +> Excel Web Services and SharePoint SOAP-based Excel Services APIs are legacy technologies and are no longer under active development. Existing solutions may continue to work, but Microsoft recommends using newer Microsoft 365 APIs and Office Scripts solutions for new development where applicable. + Excel Web Services exposes four methods for setting values into an Excel workbook: **SetCell**, **SetCellA1**, **SetRange**, and **SetRangeA1**. - -> [!NOTE] -> When you make changes to a workbook—for example, by setting values to a range using Excel Web Services—the changes to the workbook are preserved only for that particular session. The changes are not saved or persisted back to the original workbook. When the current workbook session ends (for example, when you call the **CloseWorkbook** method, or the session times out), changes you made will be lost.> If you want to save changes you make to a workbook, you can use the **GetWorkbook** method and then save the workbook using the API of the destination file store. For more information, see [How to: Get an Entire Workbook or a Snapshot](how-to-get-an-entire-workbook-or-a-snapshot.md) and [How to: Save a Workbook](https://msdn.microsoft.com/library/feb74f7a-2d8f-4672-911b-de85f8852aea%28Office.15%29.aspx). - - - +> [!NOTE] +> When you make changes to a workbook—for example, by setting values to a range using Excel Web Services—the changes to the workbook are preserved only for that particular session. The changes are not saved or persisted back to the original workbook. When the current workbook session ends (for example, when you call the **CloseWorkbook** method, or the session times out), changes you made will be lost. +> If you want to save changes you make to a workbook, you can use the **GetWorkbook** method and then save the workbook using the API of the destination file store. For more information, see [How to: Get an Entire Workbook or a Snapshot](how-to-get-an-entire-workbook-or-a-snapshot.md) and [How to: Save a Workbook](/previous-versions/office/developer/sharepoint-2007/ms575918(v=office.12)). Use the **SetCell** and **SetCellA1** methods to set values in a single cell. If you try to set values in a range of cells—for example, by passing in a range reference such as "D3:G5" or a named range that is larger than a single cell, and so on—your method call will fail. If you want to set values in a range of cells, use the **SetRange** and **SetRangeA1** methods instead. - - - - -Methods that have the A1 suffix ( **SetCellA1** and **SetRangeA1**) use a different coordinate system than those that do not ( **SetCell** and **SetRange**). If you want to use Excel-style references to cells, such as range references (for example, H8, A3:D5, Sheet2!A12:G18) or named ranges, you should use the methods with the A1 suffix. Those methods allow you to pass in the name of a sheet and range.If you want to access an Excel range by using a numeric coordinate system, you should use the methods that do not have the A1 suffix. It is easier to use range coordinates when you have code that iterates through a set of cells in a loop, or when the range coordinates are calculated dynamically as part of the algorithm.The row and column coordinates of a cell are 0-based. Therefore, "0,0" will return cell A1, as in this example: +Methods that have the A1 suffix ( **SetCellA1** and **SetRangeA1**) use a different coordinate system than those that do not ( **SetCell** and **SetRange**). If you want to use Excel-style references to cells, such as range references (for example, H8, A3:D5, Sheet2!A12:G18) or named ranges, you should use the methods with the A1 suffix. Those methods allow you to pass in the name of a sheet and range. If you want to access an Excel range by using a numeric coordinate system, you should use the methods that do not have the A1 suffix. It is easier to use range coordinates when you have code that iterates through a set of cells in a loop, or when the range coordinates are calculated dynamically as part of the algorithm. The row and column coordinates of a cell are 0-based. Therefore, "0,0" will return cell A1, as in this example: ```csharp @@ -36,24 +31,21 @@ Methods that have the A1 suffix ( **SetCellA1** and **SetRangeA1**) use a differ xlservice.SetCell(sessionId, sheetName, 0, 0, 8); ``` - - - -```VB.net +```vb ' Call the SetCell method to set a value, 8, into a cell. ' The cell is in the first row and first column; that is, cell A1. xlservice.SetCell(sessionId, sheetName, 0, 0, 8) ``` -If you are getting values from multiple adjacent cells, you may want to consider using the **SetRange** method instead of making multiple calls to the **SetCell** method. This results in a single round trip to the server instead of multiple round trips. Therefore, in some cases, you may gain a noticeable performance improvement by using the **SetRange** method instead of the **SetCell** method.When setting values into a range of cells using the **SetRange** and **SetRangeA1** methods, you use an object array ( **object[]** in C# and **Object ()** in Visual Basic .NET). The object array is actually a jagged array; each entry in the array is another array of objects representing the cells. For more information about jagged arrays, see [Jagged Arrays (C# Programming Guide)](https://go.microsoft.com/fwlink/?LinkId=65619) (https://msdn.microsoft.com/library/2s05feca.aspx). -### To set values by using the SetCell and SetRange methods +If you are getting values from multiple adjacent cells, you may want to consider using the **SetRange** method instead of making multiple calls to the **SetCell** method. This results in a single round trip to the server instead of multiple round trips. Therefore, in some cases, you may gain a noticeable performance improvement by using the **SetRange** method instead of the **SetCell** method. When setting values into a range of cells using the **SetRange** and **SetRangeA1** methods, you use an object array ( **object[]** in C# and **Object ()** in Visual Basic .NET). The object array is actually a jagged array; each entry in the array is another array of objects representing the cells. For more information about jagged arrays, see [Jagged Arrays (C# Programming Guide)](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/arrays#jagged-arrays). +### To set values by using the SetCell and SetRange methods 1. Use the **SetCell** method to set a value in a cell in the open workbook by using numeric range coordinates: - + ```csharp - + // Instantiate the Web service and make a status array object. ExcelService xlservice = new ExcelService(); Status[] outStatus; @@ -62,7 +54,7 @@ string sheetName = "Sheet2"; // Set the path to a workbook. // The workbook must be in a trusted location. -string targetWorkbookPath = "http://myserver02/example/Shared%20Documents/Book1.xlsx"; +string targetWorkbookPath = "https://myserver02/example/Shared%20Documents/Book1.xlsx"; // Set credentials for requests. xlservice.Credentials = System.Net.CredentialCache.DefaultCredentials; @@ -76,9 +68,8 @@ string sessionId = xlservice.OpenWorkbook(targetWorkbookPath, "en-US", "en-US", xlservice.SetCell(sessionId, sheetName, 8, 1, 28); ``` +```vb -``` - ' Instantiate the Web service and make a status array object. Dim xlservice As New ExcelService() Dim outStatus() As Status @@ -87,7 +78,7 @@ Dim sheetName As String = "Sheet2" ' Set the path to a workbook. ' The workbook must be in a trusted location. -Dim targetWorkbookPath As String = "http://myserver02/example/Shared%20Documents/Book1.xlsx" +Dim targetWorkbookPath As String = "https://myserver02/example/Shared%20Documents/Book1.xlsx" ' Set credentials for requests. xlservice.Credentials = System.Net.CredentialCache.DefaultCredentials @@ -103,9 +94,9 @@ xlservice.SetCell(sessionId, sheetName, 8, 1, 28) ``` 2. Use the **SetRange** method to set values in a range in the open workbook by using numeric range coordinates: - + ```csharp - + // Instantiate the Web service and make a status array object. ExcelService xlservice = new ExcelService(); Status[] outStatus; @@ -134,7 +125,7 @@ string[] fieldValues = SetRangeTextBox.Text.Split((",").ToCharArray()); if (fieldValues.Length != rangeCoordinates.Height * -rangeCoordinate.Width) +rangeCoordinates.Width) { throw new Exception("The number of inputs (" + fieldValues.Length + ") does not match" + @@ -172,9 +163,8 @@ GenerateToolErrorMessage("While calling SetRange", exc); ``` +```vb -```VB.net - ' Instantiate the Web service and make a status array object. Private xlservice As New ExcelService() Private outStatus() As Status @@ -199,8 +189,8 @@ Private Sub SetRangeButton_Click(ByVal sender As Object, ByVal e As EventArgs) Dim values(rangeCoordinates.Height - 1) As Object Dim fieldValues() As String = SetRangeTextBox.Text.Split((",").ToCharArray()) -If fieldValues.Length <> rangeCoordinates.Height * rangeCoordinate.Width Then - Throw New Exception("The number of inputs (" & fieldValues.Length & ") does not match" & " the product of Height (" & rangeCoordinates.Height & ") and Width (" & rangeCoordinates.Width & ")") +If fieldValues.Length <> rangeCoordinates.Height * rangeCoordinates.Width Then + Throw New Exception("The number of inputs (" & fieldValues.Length & ") does not match" & " the product of Height (" & rangeCoordinates.Height & ") and Width (" & rangeCoordinates.Width & ")") End If For i As Integer = 0 To rangeCoordinates.Height - 1 @@ -223,14 +213,12 @@ End Try End Sub ``` - ### To set values by using the SetCellA1 and SetRangeA1 methods - 1. Use the **SetCellA1** method to set a value in a cell in the open workbook, using the Excel "A1" range specification: - + ```csharp - + // Instantiate the Web service and make a status array object. ExcelService xlservice = new ExcelService(); Status[] outStatus; @@ -238,9 +226,8 @@ Status[] outStatus; xlservice.SetCellA1(sessionId, String.Empty, "InterestRateParam", 8); ``` +```vb -```VB.net - ' Instantiate the Web service and make a status array object. Dim xlservice As New ExcelService() Dim outStatus() As Status @@ -248,10 +235,10 @@ Dim outStatus() As Status xlservice.SetCellA1(sessionId, String.Empty, "InterestRateParam", 8) ``` -2. Use the **SetRangeA1** method to get a value from a range in the open workbook, using the Excel "A1" range specification: - +2. Use the **SetRangeA1** method to set a value in a range in the open workbook, using the Excel "A1" range specification: + ```csharp - + // Instantiate the Web service and make a status array object. ExcelService xlservice = new ExcelService(); Status[] outStatus; @@ -297,9 +284,8 @@ void SetRangeA1Button_ServerClick(object sender, EventArgs e) } ``` +```vb -```VB.net - ' Instantiate the Web service and make a status array object. Private xlservice As New ExcelService() Private outStatus() As Status @@ -312,7 +298,7 @@ Private Sub SetRangeA1Button_ServerClick(ByVal sender As Object, ByVal e As Even Dim values(height - 1) As Object Dim fieldValues() As String = RangeValuesTextBox1.Value.Split((",").ToCharArray()) If fieldValues.Length <> height * width Then - Throw New Exception("The number of inputs (" & fieldValues.Length & ") does not match" & " the product of Height (" & height & ") and Width (" & width & ")") + Throw New Exception("The number of inputs (" & fieldValues.Length & ") does not match" & " the product of Height (" & height & ") and Width (" & width & ")") End If For i As Integer = 0 To height - 1 @@ -331,32 +317,9 @@ Private Sub SetRangeA1Button_ServerClick(ByVal sender As Object, ByVal e As Even End Sub ``` - ## See also - -#### Tasks - - - - - - [How to: Specify a Range Address and Sheet Name](how-to-specify-a-range-address-and-sheet-name.md) - - - - [How to: Get Values from Ranges](how-to-get-values-from-ranges.md) -#### Concepts - - - - - - [Accessing the SOAP API](accessing-the-soap-api.md) -#### Other resources - - - - - - [Walkthrough: Developing a Custom Application Using Excel Web Services](walkthrough-developing-a-custom-application-using-excel-web-services.md) +- [How to: Specify a Range Address and Sheet Name](how-to-specify-a-range-address-and-sheet-name.md) +- [How to: Get Values from Ranges](how-to-get-values-from-ranges.md) +- [Accessing the SOAP API](accessing-the-soap-api.md) +- [Walkthrough: Developing a Custom Application Using Excel Web Services](walkthrough-developing-a-custom-application-using-excel-web-services.md) From 359b6c024eab68d902be17b4c18e2c3eba7f2623 Mon Sep 17 00:00:00 2001 From: Ashlesha-MSFT Date: Fri, 22 May 2026 16:26:38 +0530 Subject: [PATCH 2/7] fixed warning1 --- docs/general-development/how-to-get-values-from-ranges.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/general-development/how-to-get-values-from-ranges.md b/docs/general-development/how-to-get-values-from-ranges.md index 797e9eaafe..db7f7cc974 100644 --- a/docs/general-development/how-to-get-values-from-ranges.md +++ b/docs/general-development/how-to-get-values-from-ranges.md @@ -38,7 +38,7 @@ object[] rangeResult2 = xlservice.GetCell(sessionId, sheetName, 0, 0, true, out Dim rangeResult2() As Object = xlservice.GetCell(sessionId, sheetName, 0, 0, True, outStatus) ``` -If you are getting values from multiple adjacent cells, you may want to consider using the **GetRange** method instead of making multiple calls to the **GetCell** method. This results in a single roundtrip to the server instead of multiple roundtrips. Therefore, in some cases, you may gain a noticeable performance improvement by using the **GetRange** method instead of the **GetCell** method. When getting a range of cells using the **GetRange** and **GetRangeA1** methods, you get back an object array ( **object[]** in C# and **Object ()** in Visual Basic .NET). The object array is actually a jagged array. Each entry in the array you get back will be another array of objects representing the cells. For more information about jagged arrays, see [Jagged Arrays (C# Programming Guide)](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/arrays#jagged-arrays). +If you are getting values from multiple adjacent cells, you may want to consider using the **GetRange** method instead of making multiple calls to the **GetCell** method. This results in a single roundtrip to the server instead of multiple roundtrips. Therefore, in some cases, you may gain a noticeable performance improvement by using the **GetRange** method instead of the **GetCell** method. When getting a range of cells using the **GetRange** and **GetRangeA1** methods, you get back an object array ( **object[]** in C# and **Object ()** in Visual Basic .NET). The object array is actually a jagged array. Each entry in the array you get back will be another array of objects representing the cells. For more information about jagged arrays, see [Jagged Arrays (C# Programming Guide)](/dotnet/csharp/language-reference/builtin-types/arrays#jagged-arrays). ### To get values using the GetCell and GetRange methods From 27d28cfe13d588a84faabd7c22c004663a6ed3be Mon Sep 17 00:00:00 2001 From: Ashlesha-MSFT Date: Fri, 22 May 2026 16:27:33 +0530 Subject: [PATCH 3/7] fixed warning2 --- docs/general-development/how-to-set-values-of-ranges.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/general-development/how-to-set-values-of-ranges.md b/docs/general-development/how-to-set-values-of-ranges.md index 04b0aea072..196f9e8010 100644 --- a/docs/general-development/how-to-set-values-of-ranges.md +++ b/docs/general-development/how-to-set-values-of-ranges.md @@ -38,7 +38,7 @@ xlservice.SetCell(sessionId, sheetName, 0, 0, 8); xlservice.SetCell(sessionId, sheetName, 0, 0, 8) ``` -If you are getting values from multiple adjacent cells, you may want to consider using the **SetRange** method instead of making multiple calls to the **SetCell** method. This results in a single round trip to the server instead of multiple round trips. Therefore, in some cases, you may gain a noticeable performance improvement by using the **SetRange** method instead of the **SetCell** method. When setting values into a range of cells using the **SetRange** and **SetRangeA1** methods, you use an object array ( **object[]** in C# and **Object ()** in Visual Basic .NET). The object array is actually a jagged array; each entry in the array is another array of objects representing the cells. For more information about jagged arrays, see [Jagged Arrays (C# Programming Guide)](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/arrays#jagged-arrays). +If you are getting values from multiple adjacent cells, you may want to consider using the **SetRange** method instead of making multiple calls to the **SetCell** method. This results in a single round trip to the server instead of multiple round trips. Therefore, in some cases, you may gain a noticeable performance improvement by using the **SetRange** method instead of the **SetCell** method. When setting values into a range of cells using the **SetRange** and **SetRangeA1** methods, you use an object array ( **object[]** in C# and **Object ()** in Visual Basic .NET). The object array is actually a jagged array; each entry in the array is another array of objects representing the cells. For more information about jagged arrays, see [Jagged Arrays (C# Programming Guide)](/dotnet/csharp/language-reference/builtin-types/arrays#jagged-arrays). ### To set values by using the SetCell and SetRange methods From 467f389926533060c958c370a8e12499d7561bf2 Mon Sep 17 00:00:00 2001 From: Ashlesha-MSFT Date: Tue, 26 May 2026 10:20:54 +0530 Subject: [PATCH 4/7] fixed copilot reviews --- ...n-odata-data-service-for-use-as-a-bcs-external-system.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/general-development/how-to-create-an-odata-data-service-for-use-as-a-bcs-external-system.md b/docs/general-development/how-to-create-an-odata-data-service-for-use-as-a-bcs-external-system.md index c874b3b82c..834e32baa2 100644 --- a/docs/general-development/how-to-create-an-odata-data-service-for-use-as-a-bcs-external-system.md +++ b/docs/general-development/how-to-create-an-odata-data-service-for-use-as-a-bcs-external-system.md @@ -1,4 +1,4 @@ ---- +--- title: Create an OData data service for use as a BCS external system description: Learn how to create an Internet-addressable WCF service that uses OData to send notifications to SharePoint when the underlying data changes. These notifications are used to trigger events that are attached to external lists. ms.date: 09/25/2017 @@ -52,7 +52,7 @@ The following steps need to be completed: - Add capabilities for additional BCS functionality ## Installing the sample database - + An external system is usually a database, and for that reason, this example shows how to use the AdventureWorks 2012 LT sample database to represent a proprietary data source. @@ -201,4 +201,4 @@ To notify SharePoint that changes have been made, you also need to create a serv - [External content types in SharePoint](external-content-types-in-sharepoint.md) - [External events and alerts in SharePoint](external-events-and-alerts-in-sharepoint.md) - [How to: Create an external content type from an OData source in SharePoint](how-to-create-an-external-content-type-from-an-odata-source-in-sharepoint.md) -- [Business Connectivity Services programmers reference for SharePoint](business-connectivity-services-programmers-reference-for-sharepoint.md) \ No newline at end of file +- [Business Connectivity Services programmers reference for SharePoint](business-connectivity-services-programmers-reference-for-sharepoint.md) From d1ee26ea1131c5bd596a61d58b8000d4ca186e69 Mon Sep 17 00:00:00 2001 From: Ashlesha-MSFT Date: Tue, 26 May 2026 11:45:44 +0530 Subject: [PATCH 5/7] fixed copilot reviews --- .../how-to-get-an-entire-workbook-or-a-snapshot.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/general-development/how-to-get-an-entire-workbook-or-a-snapshot.md b/docs/general-development/how-to-get-an-entire-workbook-or-a-snapshot.md index bd3cc91224..9d197c145e 100644 --- a/docs/general-development/how-to-get-an-entire-workbook-or-a-snapshot.md +++ b/docs/general-development/how-to-get-an-entire-workbook-or-a-snapshot.md @@ -183,7 +183,7 @@ GetSnapshot.exe [workbook_path] > [snapshot_filename] For example: ``` -C:\\>GetSnapshot.exe http://myServer02/reports/reports/OriginalWorkbook.xlsx > SnapshotCopy.xlsx +C:\\>GetSnapshot.exe https://myServer02/reports/reports/OriginalWorkbook.xlsx > SnapshotCopy.xlsx ``` If you use the previous command-line example, the GetSnapshot tool places a new file in the "C:\\" directory. @@ -193,7 +193,7 @@ If you use the previous command-line example, the GetSnapshot tool places a new ## Robust programming -Make sure you add a Web reference to an Excel Web Services site you have access to. Change the `using GetSnapshot.myServer02;` statement to point to the Web service site you are referencing. +Make sure you add a Web reference to an Excel Web Services site you have access to. Change the C# `using GetSnapshot.myServer02;` statement or the Visual Basic `Imports GetSnapshot.myServer02` statement to point to the Web service site you are referencing. ## See also From f7896f13b0a2aa020a79f31be8f6c0c2763ada89 Mon Sep 17 00:00:00 2001 From: Andrew Connell Date: Mon, 1 Jun 2026 17:30:50 -0400 Subject: [PATCH 6/7] style: apply formatting fixes and reset ms.date MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Ordered-list markers — normalized to repeated 1. style instead of 2./3./… - Nested list formatting — tightened/normalized indentation of nested bullet lists - Code-block indentation — reindented fenced code blocks from 4 spaces to 2 - Code-block whitespace — stripped trailing whitespace and removed trailing blank lines inside fenced blocks - Blank-line collapsing — collapsed double/multiple blank lines (including runs before headings) - Trailing whitespace — removed trailing whitespace in body prose - Obsolete anchor targets — removed legacy anchors that had no inbound references - ms.date reset — reverted to the original publication date (separate from formatting, but part of the same commit) --- ...ervice-for-use-as-a-bcs-external-system.md | 100 ++-- ...-deploy-a-claims-provider-in-sharepoint.md | 196 ++++--- ...to-get-an-entire-workbook-or-a-snapshot.md | 200 ++++---- .../how-to-get-values-from-ranges.md | 292 +++++------ .../how-to-set-values-of-ranges.md | 477 +++++++++--------- 5 files changed, 606 insertions(+), 659 deletions(-) diff --git a/docs/general-development/how-to-create-an-odata-data-service-for-use-as-a-bcs-external-system.md b/docs/general-development/how-to-create-an-odata-data-service-for-use-as-a-bcs-external-system.md index 834e32baa2..bb1c5d9500 100644 --- a/docs/general-development/how-to-create-an-odata-data-service-for-use-as-a-bcs-external-system.md +++ b/docs/general-development/how-to-create-an-odata-data-service-for-use-as-a-bcs-external-system.md @@ -1,7 +1,7 @@ --- title: Create an OData data service for use as a BCS external system description: Learn how to create an Internet-addressable WCF service that uses OData to send notifications to SharePoint when the underlying data changes. These notifications are used to trigger events that are attached to external lists. -ms.date: 09/25/2017 +ms.date: 04/24/2017 ms.assetid: 7d7b3aa6-85b7-400d-8ea5-50bebac56a1d ms.localizationpriority: medium --- @@ -13,7 +13,6 @@ Learn how to create an Internet-addressable WCF service that uses OData to send This article describes how to create an ASP.NET Windows Communication Foundation (WCF) Data Service to expose the AdventureWorks 2012 LT sample database. This enables you to access the data through the Open Data protocol (OData). When access is established through OData, you can configure a Business Connectivity Services (BCS) external content type that will enable SharePoint to consume the data from the external database. To further enhance this OData source, you can add service contracts to the WCF service that will enable BCS to subscribe to notifications that indicate that the external data has changed. ## Prerequisites for creating the OData service - The following are required to create the OData service in this article: @@ -52,12 +51,10 @@ The following steps need to be completed: - Add capabilities for additional BCS functionality ## Installing the sample database - An external system is usually a database, and for that reason, this example shows how to use the AdventureWorks 2012 LT sample database to represent a proprietary data source. ## How to create the WCF OData service - Creating a Windows Communication Foundation (WCF) service that can be accessed through the OData protocol is relatively straightforward. Visual Studio 2022 provides several tools for automatically discovering and modeling the data from various data sources. This allows you to create connections and interfaces to data in SQL Server databases and other types of data stores that can then be worked with programmatically using an extensive object model. @@ -66,32 +63,32 @@ However, for SharePoint to enable BCS to receive notifications from remote syste ### To create a new WCF project 1. In Visual Studio, on the **File** menu, choose **New**, **Project**. -2. In the **New Project** dialog box, choose the **Web** template, and then choose **ASP.NET Web Application**. -3. Enter **AdventureWorksService** for the project name, and choose **OK**. -4. In **Solution Explorer**, open the shortcut menu for the ASP.NET project that you just created, and choose **Properties**. -5. Select the **Web** tab, and set the value of the **Specific port** text box to **8008**. +1. In the **New Project** dialog box, choose the **Web** template, and then choose **ASP.NET Web Application**. +1. Enter **AdventureWorksService** for the project name, and choose **OK**. +1. In **Solution Explorer**, open the shortcut menu for the ASP.NET project that you just created, and choose **Properties**. +1. Select the **Web** tab, and set the value of the **Specific port** text box to **8008**. ### To define the data model 1. In **Solution Explorer**, open the shortcut menu for the ASP.NET project, and choose **Add New Item**. -2. In the **Add New Item** dialog box, choose the Data template, and then choose **ADO.NET Entity Data Model**. -3. For the name of the data model, enter **AdventureWorks.edmx**. -4. In the **Entity Data Model Wizard**, choose **Generate from Database**, and then choose **Next**. -5. Connect the data model to the database by doing one of the following steps, and then choose **Next**. +1. In the **Add New Item** dialog box, choose the Data template, and then choose **ADO.NET Entity Data Model**. +1. For the name of the data model, enter **AdventureWorks.edmx**. +1. In the **Entity Data Model Wizard**, choose **Generate from Database**, and then choose **Next**. +1. Connect the data model to the database by doing one of the following steps, and then choose **Next**. - If you do not have a database connection already configured, choose **New Connection**, and create a new connection. - If you have a database connection already configured to connect to the Northwind database, choose that connection in the list of connections. - On the final page of the wizard, select the check boxes for all tables in the database, and clear the check boxes for views and stored procedures. -6. Choose **Finish** to close the wizard. +1. Choose **Finish** to close the wizard. ### To create the data service 1. In **Solution Explorer**, open the shortcut menu for your ASP.NET project, and then choose **Add New Item**. -2. In the **Add New Item** dialog box, choose **WCF Data Service**. -3. For the name of the service, enter **AdventureWorks**. +1. In the **Add New Item** dialog box, choose **WCF Data Service**. +1. For the name of the service, enter **AdventureWorks**. Visual Studio creates the XML markup and code files for the new service. By default, the code-editor window opens. In **Solution Explorer**, the service will have the name **AdventureWorks**, with the extension .svc.cs or .svc.vb. -4. Replace the comment `/* TODO: put your data source class name here */` in the definition of the class that defines the data service with the type that is the entity container of the data model, which in this case is **AdventureWorksEntities**. The class definition should look like the following: +1. Replace the comment `/* TODO: put your data source class name here */` in the definition of the class that defines the data service with the type that is the entity container of the data model, which in this case is **AdventureWorksEntities**. The class definition should look like the following: ```csharp public class AdventureWorks : DataService @@ -119,7 +116,7 @@ The last step in creating the service is to add service operations for the **Sub ### To add service operations for Subscribe and Unsubscribe stereotypes -- In the AdventureWorks.cs page, add the following string variable declaration. +In the **AdventureWorks.cs** file, add the following string variable declaration: ```csharp public string subscriptionStorePath = @"\\\\[SHARE_NAME]\\SubscriptionStore\\SubscriptionStore.xml"; @@ -134,67 +131,64 @@ Then add the following two **WebGet** methods to handle the subscriptions. [WebGet] public string Subscribe(string deliveryUrl, string eventType) { - string subscriptionId = Guid.NewGuid().ToString(); + string subscriptionId = Guid.NewGuid().ToString(); - XmlDocument subscriptionStore = new XmlDocument(); + XmlDocument subscriptionStore = new XmlDocument(); - subscriptionStore.Load(subscriptionStorePath); + subscriptionStore.Load(subscriptionStorePath); - // Add a new subscription element. - XmlNode newSubNode = subscriptionStore.CreateElement("Subscription"); + // Add a new subscription element. + XmlNode newSubNode = subscriptionStore.CreateElement("Subscription"); - // Add subscription ID element to the subscription element. - XmlNode subscriptionIdStart = subscriptionStore.CreateElement("SubscriptionID"); - subscriptionIdStart.InnerText = subscriptionId; - newSubNode.AppendChild(subscriptionIdStart); + // Add subscription ID element to the subscription element. + XmlNode subscriptionIdStart = subscriptionStore.CreateElement("SubscriptionID"); + subscriptionIdStart.InnerText = subscriptionId; + newSubNode.AppendChild(subscriptionIdStart); - // Add delivery URL element to the subscription element. - XmlNode deliveryAddressStart = subscriptionStore.CreateElement("DeliveryAddress"); - deliveryAddressStart.InnerText = deliveryUrl; - newSubNode.AppendChild(deliveryAddressStart); + // Add delivery URL element to the subscription element. + XmlNode deliveryAddressStart = subscriptionStore.CreateElement("DeliveryAddress"); + deliveryAddressStart.InnerText = deliveryUrl; + newSubNode.AppendChild(deliveryAddressStart); - // Add event type element to the subscription element. - XmlNode eventTypeStart = subscriptionStore.CreateElement("EventType"); - eventTypeStart.InnerText = eventType; - newSubNode.AppendChild(eventTypeStart); + // Add event type element to the subscription element. + XmlNode eventTypeStart = subscriptionStore.CreateElement("EventType"); + eventTypeStart.InnerText = eventType; + newSubNode.AppendChild(eventTypeStart); - // Add the subscription element to the root element. - subscriptionStore.AppendChild(newSubNode); + // Add the subscription element to the root element. + subscriptionStore.AppendChild(newSubNode); - subscriptionStore.Save(subscriptionStorePath); + subscriptionStore.Save(subscriptionStorePath); - return subscriptionId; + return subscriptionId; } [WebGet] public void Unsubscribe(string subscriptionId) { - XmlDocument subscriptionStore = new XmlDocument(); - subscriptionStore.Load(subscriptionStorePath); - - XmlNodeList subscriptions = subscriptionStore.DocumentElement.ChildNodes; - foreach (XmlNode subscription in subscriptions) + XmlDocument subscriptionStore = new XmlDocument(); + subscriptionStore.Load(subscriptionStorePath); + + XmlNodeList subscriptions = subscriptionStore.DocumentElement.ChildNodes; + foreach (XmlNode subscription in subscriptions) + { + XmlNodeList subscriptionList = subscription.ChildNodes; + if (subscriptionList.Item(0).InnerText == subscriptionId) { - XmlNodeList subscriptionList = subscription.ChildNodes; - if (subscriptionList.Item(0).InnerText == subscriptionId) - { - subscriptionStore.DocumentElement.RemoveChild(subscription); - break; - } + subscriptionStore.DocumentElement.RemoveChild(subscription); + break; } + } - subscriptionStore.Save(subscriptionStorePath); + subscriptionStore.Save(subscriptionStorePath); } - ``` ## Next steps - To notify SharePoint that changes have been made, you also need to create a service that queries the data source for changes, and then sends notifications to all those subscribed to notifications. ## See also - - [Business Connectivity Services in SharePoint](business-connectivity-services-in-sharepoint.md) - [Using OData sources with Business Connectivity Services in SharePoint](using-odata-sources-with-business-connectivity-services-in-sharepoint.md) diff --git a/docs/general-development/how-to-deploy-a-claims-provider-in-sharepoint.md b/docs/general-development/how-to-deploy-a-claims-provider-in-sharepoint.md index c5c6b9679d..5dbb04d40e 100644 --- a/docs/general-development/how-to-deploy-a-claims-provider-in-sharepoint.md +++ b/docs/general-development/how-to-deploy-a-claims-provider-in-sharepoint.md @@ -1,7 +1,7 @@ --- title: Deploy a claims provider in SharePoint description: Learn how to deploy a SharePoint claims provider by using the features infrastructure and creating a class that inherits from SPClaimProviderFeatureReceiver. -ms.date: 09/25/2017 +ms.date: 04/24/2017 ms.assetid: 3a5fcedc-aa9a-4ff4-95c0-0e0a7dea9d1f ms.localizationpriority: medium --- @@ -21,34 +21,33 @@ The following is an example of how to do this. ```csharp public class MyClaimProviderFeatureReceiver : SPClaimProviderFeatureReceiver +{ + public override string ClaimProviderAssembly { get { return typeof(MyClaimProvider).Assembly.FullName; } } + public override string ClaimProviderType { get { return typeof(MyClaimProvider).FullName; } } + public override string ClaimProviderDisplayName + { + get + { + return StringResourceManager.GetString(MyLocalizedClaimProviderName); + } + } + public override string ClaimProviderDescription + { + get { - public override string ClaimProviderAssembly { get { return typeof(MyClaimProvider).Assembly.FullName; } } - public override string ClaimProviderType { get { return typeof(MyClaimProvider).FullName; } } - public override string ClaimProviderDisplayName - { - get - { - return StringResourceManager.GetString(MyLocalizedClaimProviderName); - } - } - public override string ClaimProviderDescription - { - get - { - return StringResourceManager.GetString(MyLocalizedClaimProviderDescription); - } - } + return StringResourceManager.GetString(MyLocalizedClaimProviderDescription); } + } +} ``` - ## Deploying a claims provider using the feature infrastructure The following is a sample that demonstrates how to define a feature and a feature receiver that derives from [SPClaimProviderFeatureReceiver](/previous-versions/office/sharepoint-server/ee559827(v=office.15)) and override the base properties. ```csharp // Sample claims provider feature receiver class through which -// the sample claims provider registers itself +// the sample claims provider registers itself // with the Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager class. using System; @@ -57,92 +56,90 @@ using Microsoft.SharePoint.Administration.Claims; namespace MySample.Sample.Server.SampleClaimsProvider { + /// + /// The NameIdentifierClaimProviderFeatureReceiver class is a feature receiver class + /// that registers the claims provider with the claims provider manager. + /// + + [Microsoft.SharePoint.Security.SharePointPermission(System.Security.Permissions.SecurityAction.Demand, ObjectModel = true)] + public sealed class NameIdentifierClaimProviderFeatureReceiver : SPClaimProviderFeatureReceiver + { + #region Private Methods /// - /// The NameIdentifierClaimProviderFeatureReceiver class is a feature receiver class - /// that registers the claims provider with the claims provider manager. + /// Because use of base keyword can lead to unverifiable code inside a lambda expression, + /// this function is created as a wrapper for the base.FeatureActivated function. + /// This function gets called in the following lambda expression. /// - - [Microsoft.SharePoint.Security.SharePointPermission(System.Security.Permissions.SecurityAction.Demand, ObjectModel = true)] - public sealed class NameIdentifierClaimProviderFeatureReceiver : SPClaimProviderFeatureReceiver + + /// Represents the properties of a feature activation. + /// void + + private void ExecBaseFeatureActivated(Microsoft.SharePoint.SPFeatureReceiverProperties properties) { - #region Private Methods - /// - /// Because use of base keyword can lead to unverifiable code inside a lambda expression, - /// this function is created as a wrapper for the base.FeatureActivated function. - /// This function gets called in the following lambda expression. - /// - - /// Represents the properties of a feature activation. - /// void - - private void ExecBaseFeatureActivated(Microsoft.SharePoint.SPFeatureReceiverProperties properties) - { - base.FeatureActivated(properties); - } - #endregion Private Methods - - #region Public Method\\Properties - /// - /// Gets the fully qualified name of the MySample.Sample.Server.SampleClaimsProvider assembly. - /// - - /// String representing fully qualified name of the MySample.Sample.Server.SampleClaimsProvider - /// assembly. - public override string ClaimProviderAssembly - { - get{ return typeof(SampleNameIdClaimProvider).Assembly.FullName; } - } - - /// - /// Gets the fully qualified name of the claims provider type, including the namespace of the type. - /// - /// String representing the fully qualified name of the - ///SampleNameIdClaimProvider class. - public override string ClaimProviderType - { - get{ return typeof(NameIdentifierClaimProvider).FullName; } - } - - /// - /// Gets the display name of the claims provider. - /// - - /// String representing display name of the claim provider. - public override string ClaimProviderDisplayName - { - get{ return "Sample NameId Claim Provider"; } - } - - /// - /// Gets the description about the claims provider. - /// - - /// String representing the description about the SampleClaimProvider. - public override string ClaimProviderDescription - { - get - { - return "This feature adds SampleNameId claim type in the SAML token created by the STS."; - } - } - - /// - /// This method gets called after the activation of the feature. - /// - /// Represents the properties of a feature activation - /// void. - public override void FeatureActivated(Microsoft.SharePoint.SPFeatureReceiverProperties properties) - { - { - ExecBaseFeatureActivated(properties); - } - } - #endregion Public Method\\Properties + base.FeatureActivated(properties); } -} + #endregion Private Methods -``` + #region Public Method\\Properties + /// + /// Gets the fully qualified name of the MySample.Sample.Server.SampleClaimsProvider assembly. + /// + + /// String representing fully qualified name of the MySample.Sample.Server.SampleClaimsProvider + /// assembly. + public override string ClaimProviderAssembly + { + get{ return typeof(SampleNameIdClaimProvider).Assembly.FullName; } + } + + /// + /// Gets the fully qualified name of the claims provider type, including the namespace of the type. + /// + /// String representing the fully qualified name of the + ///SampleNameIdClaimProvider class. + public override string ClaimProviderType + { + get{ return typeof(NameIdentifierClaimProvider).FullName; } + } + /// + /// Gets the display name of the claims provider. + /// + + /// String representing display name of the claim provider. + public override string ClaimProviderDisplayName + { + get{ return "Sample NameId Claim Provider"; } + } + + /// + /// Gets the description about the claims provider. + /// + + /// String representing the description about the SampleClaimProvider. + public override string ClaimProviderDescription + { + get + { + return "This feature adds SampleNameId claim type in the SAML token created by the STS."; + } + } + + /// + /// This method gets called after the activation of the feature. + /// + /// Represents the properties of a feature activation + /// void. + public override void FeatureActivated(Microsoft.SharePoint.SPFeatureReceiverProperties properties) + { + { + ExecBaseFeatureActivated(properties); + } + } + #endregion Public Method\\Properties + } +} +``` ## See also @@ -150,4 +147,3 @@ namespace MySample.Sample.Server.SampleClaimsProvider - [Incoming claims: Signing into SharePoint](incoming-claims-signing-into-sharepoint.md) - [Claims provider in SharePoint](claims-provider-in-sharepoint.md) - [How to: Create a claims provider in SharePoint](how-to-create-a-claims-provider-in-sharepoint.md) - diff --git a/docs/general-development/how-to-get-an-entire-workbook-or-a-snapshot.md b/docs/general-development/how-to-get-an-entire-workbook-or-a-snapshot.md index 9d197c145e..22c134bfe0 100644 --- a/docs/general-development/how-to-get-an-entire-workbook-or-a-snapshot.md +++ b/docs/general-development/how-to-get-an-entire-workbook-or-a-snapshot.md @@ -1,7 +1,7 @@ --- title: Get an entire workbook or a snapshot description: This example shows how to get an entire workbook, a snapshot of the entire file, or just a snapshot of the viewable sheets or objects in the file by using Excel Web Services. -ms.date: 09/25/2017 +ms.date: 04/24/2017 keywords: how to,howdoi,howto f1_keywords: - how to,howdoi,howto @@ -67,56 +67,56 @@ using GetSnapshot.myServer02; namespace GetSnapshot { - class ExcelServicesSnapshot + class ExcelServicesSnapshot + { + static void Main(string[] args) { - static void Main(string[] args) + try + { + if (args.Length < 1) { - try - { - if (args.Length < 1) - { - Console.Error.WriteLine("Command line arguments should be: GetSnapshot [workbook_path] > [snapshot_filename]"); - return; - } - // Instantiate the Web service and - // create a status array object. - ExcelService xlService = new ExcelService(); - Status[] status; - - xlService.Timeout = 600000; - // Set credentials for requests. - // Use the current user's logon credentials. - xlService.Credentials = - System.Net.CredentialCache.DefaultCredentials; - - // Open the workbook, then call GetWorkbook - // and close the session. - string sessionId = xlService.OpenWorkbook(args[0], "en-US", "en-US", out status); - byte[] workbook = xlService.GetWorkbook(sessionId, WorkbookType.PublishedItemsSnapshot, out status); - // byte[] workbook = xlService.GetWorkbook(sessionId, WorkbookType.FullWorkbook, out status); - // byte[] workbook = xlService.GetWorkbook(sessionId, WorkbookType.FullSnapshot, out status); - - // Close the workbook. This also closes the session. - status = xlService.CloseWorkbook(sessionId); - - // Write the resulting Excel file to stdout - // as a binary stream. - BinaryWriter binaryWriter = new BinaryWriter(Console.OpenStandardOutput()); - binaryWriter.Write(workbook); - binaryWriter.Close(); - } - - catch (SoapException e) - { - Console.WriteLine("SOAP Exception Message: {0}", e.Message); - } - - catch (Exception e) - { - Console.WriteLine("Exception Message: {0}", e.Message); - } + Console.Error.WriteLine("Command line arguments should be: GetSnapshot [workbook_path] > [snapshot_filename]"); + return; } + // Instantiate the Web service and + // create a status array object. + ExcelService xlService = new ExcelService(); + Status[] status; + + xlService.Timeout = 600000; + // Set credentials for requests. + // Use the current user's logon credentials. + xlService.Credentials = + System.Net.CredentialCache.DefaultCredentials; + + // Open the workbook, then call GetWorkbook + // and close the session. + string sessionId = xlService.OpenWorkbook(args[0], "en-US", "en-US", out status); + byte[] workbook = xlService.GetWorkbook(sessionId, WorkbookType.PublishedItemsSnapshot, out status); + // byte[] workbook = xlService.GetWorkbook(sessionId, WorkbookType.FullWorkbook, out status); + // byte[] workbook = xlService.GetWorkbook(sessionId, WorkbookType.FullSnapshot, out status); + + // Close the workbook. This also closes the session. + status = xlService.CloseWorkbook(sessionId); + + // Write the resulting Excel file to stdout + // as a binary stream. + BinaryWriter binaryWriter = new BinaryWriter(Console.OpenStandardOutput()); + binaryWriter.Write(workbook); + binaryWriter.Close(); + } + + catch (SoapException e) + { + Console.WriteLine("SOAP Exception Message: {0}", e.Message); + } + + catch (Exception e) + { + Console.WriteLine("Exception Message: {0}", e.Message); + } } + } } ``` @@ -130,59 +130,59 @@ Imports System.Web.Services.Protocols Imports GetSnapshot.myServer02 Namespace GetSnapshot - Friend Class ExcelServicesSnapshot - Shared Sub Main(ByVal args() As String) - Try - If args.Length < 1 Then - Console.Error.WriteLine("Command line arguments should be: GetSnapshot [workbook_path] > [snapshot_filename]") - Return - End If - ' Instantiate the Web service and - ' create a status array object. - Dim xlService As New ExcelService() - Dim status() As Status - - xlService.Timeout = 600000 - ' Set credentials for requests. - ' Use the current user's logon credentials. - xlService.Credentials = System.Net.CredentialCache.DefaultCredentials - - ' Open the workbook, then call GetWorkbook - ' and close the session. - Dim sessionId As String = xlService.OpenWorkbook(args(0), "en-US", "en-US", status) - Dim workbook() As Byte = xlService.GetWorkbook(sessionId, WorkbookType.PublishedItemsSnapshot, status) - ' Dim workbook() As Byte = xlService.GetWorkbook(sessionId, WorkbookType.FullWorkbook, status) - ' Dim workbook() As Byte = xlService.GetWorkbook(sessionId, WorkbookType.FullSnapshot, status) - - ' Close the workbook. This also closes the session. - status = xlService.CloseWorkbook(sessionId) - - ' Write the resulting Excel file to stdout - ' as a binary stream. - Dim binaryWriter As New BinaryWriter(Console.OpenStandardOutput()) - binaryWriter.Write(workbook) - binaryWriter.Close() - - Catch e As SoapException - Console.WriteLine("SOAP Exception Message: {0}", e.Message) - - Catch e As Exception - Console.WriteLine("Exception Message: {0}", e.Message) - End Try - End Sub - End Class + Friend Class ExcelServicesSnapshot + Shared Sub Main(ByVal args() As String) + Try + If args.Length < 1 Then + Console.Error.WriteLine("Command line arguments should be: GetSnapshot [workbook_path] > [snapshot_filename]") + Return + End If + ' Instantiate the Web service and + ' create a status array object. + Dim xlService As New ExcelService() + Dim status() As Status + + xlService.Timeout = 600000 + ' Set credentials for requests. + ' Use the current user's logon credentials. + xlService.Credentials = System.Net.CredentialCache.DefaultCredentials + + ' Open the workbook, then call GetWorkbook + ' and close the session. + Dim sessionId As String = xlService.OpenWorkbook(args(0), "en-US", "en-US", status) + Dim workbook() As Byte = xlService.GetWorkbook(sessionId, WorkbookType.PublishedItemsSnapshot, status) + ' Dim workbook() As Byte = xlService.GetWorkbook(sessionId, WorkbookType.FullWorkbook, status) + ' Dim workbook() As Byte = xlService.GetWorkbook(sessionId, WorkbookType.FullSnapshot, status) + + ' Close the workbook. This also closes the session. + status = xlService.CloseWorkbook(sessionId) + + ' Write the resulting Excel file to stdout + ' as a binary stream. + Dim binaryWriter As New BinaryWriter(Console.OpenStandardOutput()) + binaryWriter.Write(workbook) + binaryWriter.Close() + + Catch e As SoapException + Console.WriteLine("SOAP Exception Message: {0}", e.Message) + + Catch e As Exception + Console.WriteLine("Exception Message: {0}", e.Message) + End Try + End Sub + End Class End Namespace ``` Use the following command line and arguments to run the GetSnapshot application: -``` +```console GetSnapshot.exe [workbook_path] > [snapshot_filename] ``` For example: -``` +```console C:\\>GetSnapshot.exe https://myServer02/reports/reports/OriginalWorkbook.xlsx > SnapshotCopy.xlsx ``` @@ -197,22 +197,18 @@ Make sure you add a Web reference to an Excel Web Services site you have access ## See also -#### Tasks +### Tasks [How to: Trust a Location](how-to-trust-a-location.md) -#### Concepts +### Concepts [Accessing the SOAP API](accessing-the-soap-api.md) -#### Other resources - -[Step 1: Creating the Web Service Client Project](step-1-creating-the-web-service-client-project.md) - -[Step 2: Adding a Web Reference](step-2-adding-a-web-reference.md) - -[Step 3: Accessing the Web Service](step-3-accessing-the-web-service.md) - -[Step 4: Building and Testing the Application](step-4-building-and-testing-the-application.md) +### See Also -[Walkthrough: Developing a Custom Application Using Excel Web Services](walkthrough-developing-a-custom-application-using-excel-web-services.md) +- [Step 1: Creating the Web Service Client Project](step-1-creating-the-web-service-client-project.md) +- [Step 2: Adding a Web Reference](step-2-adding-a-web-reference.md) +- [Step 3: Accessing the Web Service](step-3-accessing-the-web-service.md) +- [Step 4: Building and Testing the Application](step-4-building-and-testing-the-application.md) +- [Walkthrough: Developing a Custom Application Using Excel Web Services](walkthrough-developing-a-custom-application-using-excel-web-services.md) diff --git a/docs/general-development/how-to-get-values-from-ranges.md b/docs/general-development/how-to-get-values-from-ranges.md index db7f7cc974..b7172c9c3e 100644 --- a/docs/general-development/how-to-get-values-from-ranges.md +++ b/docs/general-development/how-to-get-values-from-ranges.md @@ -1,7 +1,7 @@ --- title: Get values from ranges description: "Excel Web Services exposes four methods for getting values from an Excel workbook: GetCell, GetCellA1, GetRange, and GetRangeA1." -ms.date: 09/25/2017 +ms.date: 04/24/2017 keywords: get range,how to,howdoi,howto f1_keywords: - get range,how to,howdoi,howto @@ -9,7 +9,6 @@ ms.assetid: ab2c0f60-b7df-46a1-9105-eb85ce817431 ms.localizationpriority: high --- - # Get values from ranges > [!IMPORTANT] @@ -24,15 +23,12 @@ Methods that have the A1 suffix ( **GetCellA1** and **GetRangeA1**) use a differ If you want to access an Excel range by using a numeric coordinate system, you should use the methods that do not have the A1 suffix. It is easier to use range coordinates when you have code that iterates through a set of cells in a loop, or when the range coordinates are calculated dynamically as part of the algorithm. The row and column coordinates of a cell are 0-based. Therefore, "0,0" will return cell A1, as in this example: ```csharp - // Call the GetCell method to retrieve a value from a cell. // The cell is in the first row and first column; that is, cell A1 object[] rangeResult2 = xlservice.GetCell(sessionId, sheetName, 0, 0, true, out outStatus); ``` - ```vb - ' Call the GetCell method to retrieve a value from a cell. ' The cell is in the first row and first column; that is, cell A1 Dim rangeResult2() As Object = xlservice.GetCell(sessionId, sheetName, 0, 0, True, outStatus) @@ -42,181 +38,153 @@ If you are getting values from multiple adjacent cells, you may want to consider ### To get values using the GetCell and GetRange methods - 1. Use the **GetCell** method to get a value from a cell in the open workbook by using numeric range coordinates; for example: - -```csharp - -// Instantiate the Web service and make a status array object. -ExcelService xlservice = new ExcelService(); -Status[] outStatus; -string sheetName = "Sheet2"; - -// Set the path to a workbook. -// The workbook must be in a trusted location. -string targetWorkbookPath = "https://myserver02/example/Shared%20Documents/Book1.xlsx"; - -// Set credentials for requests. -xlservice.Credentials = System.Net.CredentialCache.DefaultCredentials; - -// Call the open workbook, and point to the trusted -// location of the workbook to open. -string sessionId = xlservice.OpenWorkbook(targetWorkbookPath, "en-US", "en-US", out outStatus); - -// Call the GetCell method to retrieve a value from a cell. -// The cell is in the first row and ninth column. -object[] rangeResult2 = xlservice.GetCell(sessionId, sheetName, 0, 8, false, out outStatus); -``` - - -```vb - -' Instantiate the Web service and make a status array object. -Dim xlservice As New ExcelService() -Dim outStatus() As Status -Dim sheetName As String = "Sheet2" - -' Set the path to a workbook. -' The workbook must be in a trusted location. -Dim targetWorkbookPath As String = "https://myserver02/example/Shared%20Documents/Book1.xlsx" - -' Set credentials for requests. -xlservice.Credentials = System.Net.CredentialCache.DefaultCredentials - -' Call the open workbook, and point to the trusted -' location of the workbook to open. -Dim sessionId As String = xlservice.OpenWorkbook(targetWorkbookPath, "en-US", "en-US", outStatus) - -' Call the GetCell method to retrieve a value from a cell. -' The cell is in the first row and ninth column. -Dim rangeResult2() As Object = xlservice.GetCell(sessionId, sheetName, 0, 8, False, outStatus) -``` -2. Use the **GetRange** method to get values from a range in the open workbook by using numeric range coordinates. - -```csharp - -// Instantiate the Web service and make a status array object. -ExcelService xlservice = new ExcelService(); -Status[] outStatus; -RangeCoordinates rangeCoordinates = new RangeCoordinates(); -string sheetName = "Sheet1"; -... -// Prepare object to define range coordinates -// and call the GetRange method. -// startCol, startRow, startHeight, and startWidth -// get their value from user input. -rangeCoordinates.Column = (int)startCol.Value; -rangeCoordinates.Row = (int)startRow.Value; -rangeCoordinates.Height = (int)startHeight.Value; -rangeCoordinates.Width = (int)startWidth.Value; -... -object[] rangeResult1s = xlservice.GetRange(sessionId, sheetName, rangeCoordinates, false, out outStatus); -foreach (object[] x in rangeResult1s) -{ - foreach (object y in x) + ```csharp + // Instantiate the Web service and make a status array object. + ExcelService xlservice = new ExcelService(); + Status[] outStatus; + string sheetName = "Sheet2"; + + // Set the path to a workbook. + // The workbook must be in a trusted location. + string targetWorkbookPath = "https://myserver02/example/Shared%20Documents/Book1.xlsx"; + + // Set credentials for requests. + xlservice.Credentials = System.Net.CredentialCache.DefaultCredentials; + + // Call the open workbook, and point to the trusted + // location of the workbook to open. + string sessionId = xlservice.OpenWorkbook(targetWorkbookPath, "en-US", "en-US", out outStatus); + + // Call the GetCell method to retrieve a value from a cell. + // The cell is in the first row and ninth column. + object[] rangeResult2 = xlservice.GetCell(sessionId, sheetName, 0, 8, false, out outStatus); + ``` + + ```vb + ' Instantiate the Web service and make a status array object. + Dim xlservice As New ExcelService() + Dim outStatus() As Status + Dim sheetName As String = "Sheet2" + + ' Set the path to a workbook. + ' The workbook must be in a trusted location. + Dim targetWorkbookPath As String = "https://myserver02/example/Shared%20Documents/Book1.xlsx" + + ' Set credentials for requests. + xlservice.Credentials = System.Net.CredentialCache.DefaultCredentials + + ' Call the open workbook, and point to the trusted + ' location of the workbook to open. + Dim sessionId As String = xlservice.OpenWorkbook(targetWorkbookPath, "en-US", "en-US", outStatus) + + ' Call the GetCell method to retrieve a value from a cell. + ' The cell is in the first row and ninth column. + Dim rangeResult2() As Object = xlservice.GetCell(sessionId, sheetName, 0, 8, False, outStatus) + ``` + + 1. Use the **GetRange** method to get values from a range in the open workbook by using numeric range coordinates. + + ```csharp + // Instantiate the Web service and make a status array object. + ExcelService xlservice = new ExcelService(); + Status[] outStatus; + RangeCoordinates rangeCoordinates = new RangeCoordinates(); + string sheetName = "Sheet1"; + ... + // Prepare object to define range coordinates + // and call the GetRange method. + // startCol, startRow, startHeight, and startWidth + // get their value from user input. + rangeCoordinates.Column = (int)startCol.Value; + rangeCoordinates.Row = (int)startRow.Value; + rangeCoordinates.Height = (int)startHeight.Value; + rangeCoordinates.Width = (int)startWidth.Value; + ... + object[] rangeResult1s = xlservice.GetRange(sessionId, sheetName, rangeCoordinates, false, out outStatus); + foreach (object[] x in rangeResult1s) { + foreach (object y in x) + { Console.WriteLine(String.Format("{0}", y)); + } } -} -``` - - -```vb - -' Instantiate the Web service and make a status array object. -Dim xlservice As New ExcelService() -Dim outStatus() As Status -Dim rangeCoordinates As New RangeCoordinates() -Dim sheetName As String = "Sheet1" -... -' Prepare object to define range coordinates -' and call the GetRange method. -' startCol, startRow, startHeight, and startWidth -' get their value from user input. -rangeCoordinates.Column = CInt(Fix(startCol.Value)) -rangeCoordinates.Row = CInt(Fix(startRow.Value)) -rangeCoordinates.Height = CInt(Fix(startHeight.Value)) -rangeCoordinates.Width = CInt(Fix(startWidth.Value)) -... -Dim rangeResult1s() As Object = xlservice.GetRange(sessionId, sheetName, rangeCoordinates, False, outStatus) -For Each x As Object() In rangeResult1s - For Each y As Object In x + ``` + + ```vb + ' Instantiate the Web service and make a status array object. + Dim xlservice As New ExcelService() + Dim outStatus() As Status + Dim rangeCoordinates As New RangeCoordinates() + Dim sheetName As String = "Sheet1" + ... + ' Prepare object to define range coordinates + ' and call the GetRange method. + ' startCol, startRow, startHeight, and startWidth + ' get their value from user input. + rangeCoordinates.Column = CInt(Fix(startCol.Value)) + rangeCoordinates.Row = CInt(Fix(startRow.Value)) + rangeCoordinates.Height = CInt(Fix(startHeight.Value)) + rangeCoordinates.Width = CInt(Fix(startWidth.Value)) + ... + Dim rangeResult1s() As Object = xlservice.GetRange(sessionId, sheetName, rangeCoordinates, False, outStatus) + For Each x As Object() In rangeResult1s + For Each y As Object In x Console.WriteLine(String.Format("{0}", y)) - Next y -Next x -``` + Next y + Next x + ``` + ### To get values using the GetCellA1 and GetRangeA1 methods -### To get values using the GetCellA1 and GetRangeA1 methods + 1. Use the **GetCellA1** method to get a value from a cell in the open workbook, using the Excel "A1" range specification; for example: + ```csharp + // Instantiate the Web service and make a status array object. + ExcelService xlservice = new ExcelService(); + Status[] outStatus; + string sheetName = "Sheet2"; -1. Use the **GetCellA1** method to get a value from a cell in the open workbook, using the Excel "A1" range specification; for example: - -```csharp - -// Instantiate the Web service and make a status array object. -ExcelService xlservice = new ExcelService(); -Status[] outStatus; -string sheetName = "Sheet2"; + object[] rangeResult = xlservice.GetCellA1(sessionId, sheetName, "MonthlyPayment", true, out outStatus); + ``` -object[] rangeResult = xlservice.GetCellA1(sessionId, sheetName, "MonthlyPayment", true, out outStatus); -``` + ```vb + ' Instantiate the Web service and make a status array object. + Dim xlservice As New ExcelService() + Dim outStatus() As Status + Dim sheetName As String = "Sheet2" + Dim rangeResult() As Object = xlservice.GetCellA1(sessionId, sheetName, "MonthlyPayment", True, outStatus) + ``` -```vb - -' Instantiate the Web service and make a status array object. -Dim xlservice As New ExcelService() -Dim outStatus() As Status -Dim sheetName As String = "Sheet2" +1. Use the **GetRangeA1** method to get a value from a range in the open workbook, using the Excel "A1" range specification. The following code example asks for a 2x3 range, that is, two rows by three columns. The code then loops through each row that is returned and retrieves the three cells each row contains. That is, in the first iteration: -Dim rangeResult() As Object = xlservice.GetCellA1(sessionId, sheetName, "MonthlyPayment", True, outStatus) -``` + - rangeResult [0] returns the value in cell B2 + - rangeResult [1] returns the value in cell C2 + - rangeResult [2] returns the value in cell D2 -2. Use the **GetRangeA1** method to get a value from a range in the open workbook, using the Excel "A1" range specification. The following code example asks for a 2x3 range, that is, two rows by three columns. The code then loops through each row that is returned and retrieves the three cells each row contains. That is, in the first iteration: - - - rangeResult [0] returns the value in cell B2 - - - - rangeResult [1] returns the value in cell C2 - - - - rangeResult [2] returns the value in cell D2 - In the second iteration: - - - - rangeResult [0] returns the value in cell B3 - - - - rangeResult [1] returns the value in cell C3 - - - - rangeResult [2] returns the value in cell D3 - - -```csharp - -object[] rangeResults = xlservice.GetRangeA1(sessionId, "Sheet1", "B2:D3", true, out outStatus); -foreach (object[] rangeResult in rangeResults) -{ - Console.WriteLine(String.Format("{0} | {1} | {2}", - rangeResult[0], rangeResult[1], rangeResult[2])); -} - -``` - - -```vb - -Dim rangeResults() As Object = xlservice.GetRangeA1(sessionId, "Sheet1", "B2:D3", True, outStatus) -For Each rangeResult As Object() In rangeResults - Console.WriteLine(String.Format("{0} | {1} | {2}", rangeResult(0), rangeResult(1), rangeResult(2))) -Next rangeResult -``` + - rangeResult [0] returns the value in cell B3 + - rangeResult [1] returns the value in cell C3 + - rangeResult [2] returns the value in cell D3 + ```csharp + object[] rangeResults = xlservice.GetRangeA1(sessionId, "Sheet1", "B2:D3", true, out outStatus); + foreach (object[] rangeResult in rangeResults) + { + Console.WriteLine(String.Format("{0} | {1} | {2}", + rangeResult[0], rangeResult[1], rangeResult[2])); + } + ``` + + ```vb + Dim rangeResults() As Object = xlservice.GetRangeA1(sessionId, "Sheet1", "B2:D3", True, outStatus) + For Each rangeResult As Object() In rangeResults + Console.WriteLine(String.Format("{0} | {1} | {2}", rangeResult(0), rangeResult(1), rangeResult(2))) + Next rangeResult + ``` ## See also diff --git a/docs/general-development/how-to-set-values-of-ranges.md b/docs/general-development/how-to-set-values-of-ranges.md index 196f9e8010..acc99e130b 100644 --- a/docs/general-development/how-to-set-values-of-ranges.md +++ b/docs/general-development/how-to-set-values-of-ranges.md @@ -1,7 +1,7 @@ --- title: Set values of ranges description: "Excel Web Services exposes four methods for setting values into an Excel workbook: SetCell, SetCellA1, SetRange, and SetRangeA1." -ms.date: 09/25/2017 +ms.date: 04/24/2017 keywords: how to,howdoi,howto,set range f1_keywords: - how to,howdoi,howto,set range @@ -14,25 +14,23 @@ ms.localizationpriority: medium > [!IMPORTANT] > Excel Web Services and SharePoint SOAP-based Excel Services APIs are legacy technologies and are no longer under active development. Existing solutions may continue to work, but Microsoft recommends using newer Microsoft 365 APIs and Office Scripts solutions for new development where applicable. -Excel Web Services exposes four methods for setting values into an Excel workbook: **SetCell**, **SetCellA1**, **SetRange**, and **SetRangeA1**. +Excel Web Services exposes four methods for setting values into an Excel workbook: **SetCell**, **SetCellA1**, **SetRange**, and **SetRangeA1**. > [!NOTE] > When you make changes to a workbook—for example, by setting values to a range using Excel Web Services—the changes to the workbook are preserved only for that particular session. The changes are not saved or persisted back to the original workbook. When the current workbook session ends (for example, when you call the **CloseWorkbook** method, or the session times out), changes you made will be lost. -> If you want to save changes you make to a workbook, you can use the **GetWorkbook** method and then save the workbook using the API of the destination file store. For more information, see [How to: Get an Entire Workbook or a Snapshot](how-to-get-an-entire-workbook-or-a-snapshot.md) and [How to: Save a Workbook](/previous-versions/office/developer/sharepoint-2007/ms575918(v=office.12)). +> If you want to save changes you make to a workbook, you can use the **GetWorkbook** method and then save the workbook using the API of the destination file store. For more information, see [How to: Get an Entire Workbook or a Snapshot](how-to-get-an-entire-workbook-or-a-snapshot.md) and [How to: Save a Workbook](/previous-versions/office/developer/sharepoint-2007/ms575918(v=office.12)). Use the **SetCell** and **SetCellA1** methods to set values in a single cell. If you try to set values in a range of cells—for example, by passing in a range reference such as "D3:G5" or a named range that is larger than a single cell, and so on—your method call will fail. If you want to set values in a range of cells, use the **SetRange** and **SetRangeA1** methods instead. Methods that have the A1 suffix ( **SetCellA1** and **SetRangeA1**) use a different coordinate system than those that do not ( **SetCell** and **SetRange**). If you want to use Excel-style references to cells, such as range references (for example, H8, A3:D5, Sheet2!A12:G18) or named ranges, you should use the methods with the A1 suffix. Those methods allow you to pass in the name of a sheet and range. If you want to access an Excel range by using a numeric coordinate system, you should use the methods that do not have the A1 suffix. It is easier to use range coordinates when you have code that iterates through a set of cells in a loop, or when the range coordinates are calculated dynamically as part of the algorithm. The row and column coordinates of a cell are 0-based. Therefore, "0,0" will return cell A1, as in this example: ```csharp - // Call the SetCell method to set a value, 8, into a cell. // The cell is in the first row and first column; that is, cell A1. xlservice.SetCell(sessionId, sheetName, 0, 0, 8); ``` ```vb - ' Call the SetCell method to set a value, 8, into a cell. ' The cell is in the first row and first column; that is, cell A1. xlservice.SetCell(sessionId, sheetName, 0, 0, 8) @@ -40,282 +38,277 @@ xlservice.SetCell(sessionId, sheetName, 0, 0, 8) If you are getting values from multiple adjacent cells, you may want to consider using the **SetRange** method instead of making multiple calls to the **SetCell** method. This results in a single round trip to the server instead of multiple round trips. Therefore, in some cases, you may gain a noticeable performance improvement by using the **SetRange** method instead of the **SetCell** method. When setting values into a range of cells using the **SetRange** and **SetRangeA1** methods, you use an object array ( **object[]** in C# and **Object ()** in Visual Basic .NET). The object array is actually a jagged array; each entry in the array is another array of objects representing the cells. For more information about jagged arrays, see [Jagged Arrays (C# Programming Guide)](/dotnet/csharp/language-reference/builtin-types/arrays#jagged-arrays). -### To set values by using the SetCell and SetRange methods +## To set values by using the SetCell and SetRange methods 1. Use the **SetCell** method to set a value in a cell in the open workbook by using numeric range coordinates: -```csharp - -// Instantiate the Web service and make a status array object. -ExcelService xlservice = new ExcelService(); -Status[] outStatus; -RangeCoordinates rangeCoordinates = new RangeCoordinates(); -string sheetName = "Sheet2"; - -// Set the path to a workbook. -// The workbook must be in a trusted location. -string targetWorkbookPath = "https://myserver02/example/Shared%20Documents/Book1.xlsx"; - -// Set credentials for requests. -xlservice.Credentials = System.Net.CredentialCache.DefaultCredentials; - -// Call the open workbook, and point to the trusted -// location of the workbook to open. -string sessionId = xlservice.OpenWorkbook(targetWorkbookPath, "en-US", "en-US", out outStatus); - -// Call the SetCell method to set the cell's value to 28. -// The cell is in the ninth row and second column, which is cell B9. -xlservice.SetCell(sessionId, sheetName, 8, 1, 28); -``` - -```vb - -' Instantiate the Web service and make a status array object. -Dim xlservice As New ExcelService() -Dim outStatus() As Status -Dim rangeCoordinates As New RangeCoordinates() -Dim sheetName As String = "Sheet2" - -' Set the path to a workbook. -' The workbook must be in a trusted location. -Dim targetWorkbookPath As String = "https://myserver02/example/Shared%20Documents/Book1.xlsx" - -' Set credentials for requests. -xlservice.Credentials = System.Net.CredentialCache.DefaultCredentials - -' Call the open workbook, and point to the trusted -' location of the workbook to open. -Dim sessionId As String = xlservice.OpenWorkbook(targetWorkbookPath, "en-US", "en-US", outStatus) - -' Call the SetCell method to set the cell's value to 28. -' The cell is in the ninth row and second column, which is cell B9. -xlservice.SetCell(sessionId, sheetName, 8, 1, 28) - -``` - -2. Use the **SetRange** method to set values in a range in the open workbook by using numeric range coordinates: - -```csharp - -// Instantiate the Web service and make a status array object. -ExcelService xlservice = new ExcelService(); -Status[] outStatus; -RangeCoordinates rangeCoordinates = new RangeCoordinates(); - -... -private void Form1_Load(object sender, EventArgs e) -{ -... -... -//Prepare object to define range coordinates -//and call the GetRange method. -//startCol, startRow, startHeight, and startWidth -//get their values from user input. -rangeCoordinates.Column = (int)startCol.Value; -rangeCoordinates.Row = (int)startRow.Value; -rangeCoordinates.Height = (int)startHeight.Value; -rangeCoordinates.Width = (int)startWidth.Value; -... -... -} -private void SetRangeButton_Click(object sender, EventArgs e) -{ -object[] values = new object[rangeCoordinates.Height]; -string[] fieldValues = - SetRangeTextBox.Text.Split((",").ToCharArray()); - -if (fieldValues.Length != rangeCoordinates.Height * -rangeCoordinates.Width) + ```csharp + // Instantiate the Web service and make a status array object. + ExcelService xlservice = new ExcelService(); + Status[] outStatus; + RangeCoordinates rangeCoordinates = new RangeCoordinates(); + string sheetName = "Sheet2"; + + // Set the path to a workbook. + // The workbook must be in a trusted location. + string targetWorkbookPath = "https://myserver02/example/Shared%20Documents/Book1.xlsx"; + + // Set credentials for requests. + xlservice.Credentials = System.Net.CredentialCache.DefaultCredentials; + + // Call the open workbook, and point to the trusted + // location of the workbook to open. + string sessionId = xlservice.OpenWorkbook(targetWorkbookPath, "en-US", "en-US", out outStatus); + + // Call the SetCell method to set the cell's value to 28. + // The cell is in the ninth row and second column, which is cell B9. + xlservice.SetCell(sessionId, sheetName, 8, 1, 28); + ``` + + ```vb + ' Instantiate the Web service and make a status array object. + Dim xlservice As New ExcelService() + Dim outStatus() As Status + Dim rangeCoordinates As New RangeCoordinates() + Dim sheetName As String = "Sheet2" + + ' Set the path to a workbook. + ' The workbook must be in a trusted location. + Dim targetWorkbookPath As String = "https://myserver02/example/Shared%20Documents/Book1.xlsx" + + ' Set credentials for requests. + xlservice.Credentials = System.Net.CredentialCache.DefaultCredentials + + ' Call the open workbook, and point to the trusted + ' location of the workbook to open. + Dim sessionId As String = xlservice.OpenWorkbook(targetWorkbookPath, "en-US", "en-US", outStatus) + + ' Call the SetCell method to set the cell's value to 28. + ' The cell is in the ninth row and second column, which is cell B9. + xlservice.SetCell(sessionId, sheetName, 8, 1, 28) + ``` + +1. Use the **SetRange** method to set values in a range in the open workbook by using numeric range coordinates: + + ```csharp + // Instantiate the Web service and make a status array object. + ExcelService xlservice = new ExcelService(); + Status[] outStatus; + RangeCoordinates rangeCoordinates = new RangeCoordinates(); + + ... + private void Form1_Load(object sender, EventArgs e) { - throw new Exception("The number of inputs (" + - fieldValues.Length + ") does not match" + - " the product of Height (" + rangeCoordinates.Height + ") and Width (" + - rangeCoordinates.Width + ")"); + ... + ... + //Prepare object to define range coordinates + //and call the GetRange method. + //startCol, startRow, startHeight, and startWidth + //get their values from user input. + rangeCoordinates.Column = (int)startCol.Value; + rangeCoordinates.Row = (int)startRow.Value; + rangeCoordinates.Height = (int)startHeight.Value; + rangeCoordinates.Width = (int)startWidth.Value; + ... + ... } + private void SetRangeButton_Click(object sender, EventArgs e) + { + object[] values = new object[rangeCoordinates.Height]; + string[] fieldValues = SetRangeTextBox.Text.Split((",").ToCharArray()); -for (int i = 0; i < rangeCoordinates.Height; i++) + if (fieldValues.Length != rangeCoordinates.Height * rangeCoordinates.Width) { - object[] currentRow = - new object[rangeCoordinates.Width]; - for (int j = 0; j < rangeCoordinates.Width; j++) - { - currentRow[j] = fieldValues[i * rangeCoordinates.Width + j]; - } - values[i] = currentRow; + throw new Exception("The number of inputs (" + + fieldValues.Length + + ") does not match the product of Height (" + + rangeCoordinates.Height + + ") and Width (" + + rangeCoordinates.Width + + ")"); } -SetStatusText("Waiting for SetRange..."); -outStatus = xlservice.SetRange( - sessionID, SheetNameTextBox.Text, - rangeCoordinates, values); -} -catch (SoapException exc) -{ -StopTimer("SetRange"); -GenerateErrorMessage("SetRange", exc); -} -catch (Exception exc) -{ -StopTimer("SetRange"); -GenerateToolErrorMessage("While calling SetRange", exc); -} -} - -``` - -```vb - -' Instantiate the Web service and make a status array object. -Private xlservice As New ExcelService() -Private outStatus() As Status -Private rangeCoordinates As New RangeCoordinates() - -... -Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) -... -... -'Prepare object to define range coordinates -'and call the GetRange method. -'startCol, startRow, startHeight, and startWidth -'get their values from user input. -rangeCoordinates.Column = CInt(Fix(startCol.Value)) -rangeCoordinates.Row = CInt(Fix(startRow.Value)) -rangeCoordinates.Height = CInt(Fix(startHeight.Value)) -rangeCoordinates.Width = CInt(Fix(startWidth.Value)) -... -... -End Sub -Private Sub SetRangeButton_Click(ByVal sender As Object, ByVal e As EventArgs) -Dim values(rangeCoordinates.Height - 1) As Object -Dim fieldValues() As String = SetRangeTextBox.Text.Split((",").ToCharArray()) - -If fieldValues.Length <> rangeCoordinates.Height * rangeCoordinates.Width Then - Throw New Exception("The number of inputs (" & fieldValues.Length & ") does not match" & " the product of Height (" & rangeCoordinates.Height & ") and Width (" & rangeCoordinates.Width & ")") -End If - -For i As Integer = 0 To rangeCoordinates.Height - 1 - Dim currentRow(rangeCoordinates.Width - 1) As Object - For j As Integer = 0 To rangeCoordinates.Width - 1 - currentRow(j) = fieldValues(i * rangeCoordinates.Width + j) - Next j - values(i) = currentRow -Next i -Try -SetStatusText("Waiting for SetRange...") -outStatus = xlservice.SetRange(sessionID, SheetNameTextBox.Text, rangeCoordinates, values) -Catch exc As SoapException -StopTimer("SetRange") -GenerateErrorMessage("SetRange", exc) -Catch exc As Exception -StopTimer("SetRange") -GenerateToolErrorMessage("While calling SetRange", exc) -End Try -End Sub -``` + for (int i = 0; i < rangeCoordinates.Height; i++) + { + object[] currentRow = new object[rangeCoordinates.Width]; + for (int j = 0; j < rangeCoordinates.Width; j++) + { + currentRow[j] = fieldValues[i * rangeCoordinates.Width + j]; + } + values[i] = currentRow; + } -### To set values by using the SetCellA1 and SetRangeA1 methods + SetStatusText("Waiting for SetRange..."); + outStatus = xlservice.SetRange(sessionID, + SheetNameTextBox.Text, + rangeCoordinates, + values); + } + catch (SoapException exc) + { + StopTimer("SetRange"); + GenerateErrorMessage("SetRange", exc); + } + catch (Exception exc) + { + StopTimer("SetRange"); + GenerateToolErrorMessage("While calling SetRange", exc); + } + } + ``` + + ```vb + 'Instantiate the Web service and make a status array object. + Private xlservice As New ExcelService() + Private outStatus() As Status + Private rangeCoordinates As New RangeCoordinates() + + ... + Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) + ... + ... + 'Prepare object to define range coordinates + 'and call the GetRange method. + 'startCol, startRow, startHeight, and startWidth + 'get their values from user input. + rangeCoordinates.Column = CInt(Fix(startCol.Value)) + rangeCoordinates.Row = CInt(Fix(startRow.Value)) + rangeCoordinates.Height = CInt(Fix(startHeight.Value)) + rangeCoordinates.Width = CInt(Fix(startWidth.Value)) + ... + ... + End Sub + + Private Sub SetRangeButton_Click(ByVal sender As Object, ByVal e As EventArgs) + Dim values(rangeCoordinates.Height - 1) As Object + Dim fieldValues() As String = SetRangeTextBox.Text.Split((",").ToCharArray()) + + If fieldValues.Length <> rangeCoordinates.Height * rangeCoordinates.Width Then + Throw New Exception("The number of inputs (" & fieldValues.Length & ") does not match" & " the product of Height (" & rangeCoordinates.Height & ") and Width (" & rangeCoordinates.Width & ")") + End If + + For i As Integer = 0 To rangeCoordinates.Height - 1 + Dim currentRow(rangeCoordinates.Width - 1) As Object + For j As Integer = 0 To rangeCoordinates.Width - 1 + currentRow(j) = fieldValues(i * rangeCoordinates.Width + j) + Next j + values(i) = currentRow + Next i + + Try + SetStatusText("Waiting for SetRange...") + outStatus = xlservice.SetRange(sessionID, SheetNameTextBox.Text, rangeCoordinates, values) + Catch exc As SoapException + StopTimer("SetRange") + GenerateErrorMessage("SetRange", exc) + Catch exc As Exception + StopTimer("SetRange") + GenerateToolErrorMessage("While calling SetRange", exc) + End Try + End Sub + ``` + +## To set values by using the SetCellA1 and SetRangeA1 methods 1. Use the **SetCellA1** method to set a value in a cell in the open workbook, using the Excel "A1" range specification: -```csharp - -// Instantiate the Web service and make a status array object. -ExcelService xlservice = new ExcelService(); -Status[] outStatus; - -xlservice.SetCellA1(sessionId, String.Empty, "InterestRateParam", 8); -``` - -```vb + ```csharp + // Instantiate the Web service and make a status array object. + ExcelService xlservice = new ExcelService(); + Status[] outStatus; -' Instantiate the Web service and make a status array object. -Dim xlservice As New ExcelService() -Dim outStatus() As Status + xlservice.SetCellA1(sessionId, String.Empty, "InterestRateParam", 8); + ``` -xlservice.SetCellA1(sessionId, String.Empty, "InterestRateParam", 8) -``` + ```vb + ' Instantiate the Web service and make a status array object. + Dim xlservice As New ExcelService() + Dim outStatus() As Status -2. Use the **SetRangeA1** method to set a value in a range in the open workbook, using the Excel "A1" range specification: + xlservice.SetCellA1(sessionId, String.Empty, "InterestRateParam", 8) + ``` -```csharp +1. Use the **SetRangeA1** method to set a value in a range in the open workbook, using the Excel "A1" range specification: -// Instantiate the Web service and make a status array object. -ExcelService xlservice = new ExcelService(); -Status[] outStatus; -... - -void SetRangeA1Button_ServerClick(object sender, EventArgs e) -{ - int height, width; - CalculateHeightAndWidth(RangeNameTextBox5.Value.Trim(), - out height, out width); - - object[] values = new object[height]; - string[] fieldValues = - RangeValuesTextBox1.Value.Split((",").ToCharArray()); - if (fieldValues.Length != height * width) - { - throw new Exception("The number of inputs (" + - fieldValues.Length + ") does not match" + - " the product of Height (" + height + ") and - Width (" + width + ")"); - } + ```csharp + // Instantiate the Web service and make a status array object. + ExcelService xlservice = new ExcelService(); + Status[] outStatus; + ... - for (int i = 0; i < height; i++) + void SetRangeA1Button_ServerClick(object sender, EventArgs e) { + int height, width; + CalculateHeightAndWidth(RangeNameTextBox5.Value.Trim(), out height, out width); + + object[] values = new object[height]; + string[] fieldValues = RangeValuesTextBox1.Value.Split((",").ToCharArray()); + if (fieldValues.Length != height * width) + { + throw new Exception("The number of inputs (" + + fieldValues.Length + + ") does not match the product of Height (" + + height + + ") and Width (" + + width + ")"); + } + + for (int i = 0; i < height; i++) + { object[] currentRow = new object[width]; for (int j = 0; j < width; j++) { - currentRow[j] = fieldValues[i * width + j]; + currentRow[j] = fieldValues[i * width + j]; } values[i] = currentRow; - } - try - { - xlservice.SetRangeA1(SessionIDTextBox.Value, - SheetNameTextBox1.Value,RangeNameTextBox5.Value, - values, out outStatus); - } - catch (SoapException exc) - { + } + try + { + xlservice.SetRangeA1(SessionIDTextBox.Value, + SheetNameTextBox1.Value, + RangeNameTextBox5.Value, + values, + out outStatus); + } + catch (SoapException exc) + { ExceptionTextBox1.Value = exc.Message; - } - -} -``` + } -```vb + } + ``` -' Instantiate the Web service and make a status array object. -Private xlservice As New ExcelService() -Private outStatus() As Status -... + ```vb + ' Instantiate the Web service and make a status array object. + Private xlservice As New ExcelService() + Private outStatus() As Status + ... -Private Sub SetRangeA1Button_ServerClick(ByVal sender As Object, ByVal e As EventArgs) - Dim height, width As Integer - CalculateHeightAndWidth(RangeNameTextBox5.Value.Trim(), height, width) + Private Sub SetRangeA1Button_ServerClick(ByVal sender As Object, ByVal e As EventArgs) + Dim height, width As Integer + CalculateHeightAndWidth(RangeNameTextBox5.Value.Trim(), height, width) - Dim values(height - 1) As Object - Dim fieldValues() As String = RangeValuesTextBox1.Value.Split((",").ToCharArray()) - If fieldValues.Length <> height * width Then + Dim values(height - 1) As Object + Dim fieldValues() As String = RangeValuesTextBox1.Value.Split((",").ToCharArray()) + If fieldValues.Length <> height * width Then Throw New Exception("The number of inputs (" & fieldValues.Length & ") does not match" & " the product of Height (" & height & ") and Width (" & width & ")") - End If + End If - For i As Integer = 0 To height - 1 + For i As Integer = 0 To height - 1 Dim currentRow(width - 1) As Object For j As Integer = 0 To width - 1 - currentRow(j) = fieldValues(i * width + j) + currentRow(j) = fieldValues(i * width + j) Next j values(i) = currentRow - Next i - Try + Next i + Try xlservice.SetRangeA1(SessionIDTextBox.Value, SheetNameTextBox1.Value,RangeNameTextBox5.Value, values, outStatus) - Catch exc As SoapException + Catch exc As SoapException ExceptionTextBox1.Value = exc.Message - End Try + End Try -End Sub -``` + End Sub + ``` ## See also From b383f9a49aff4756e13f34b06c9df888c77a6736 Mon Sep 17 00:00:00 2001 From: Andrew Connell Date: Mon, 1 Jun 2026 18:29:11 -0400 Subject: [PATCH 7/7] fixup renderings --- ...n-odata-data-service-for-use-as-a-bcs-external-system.md | 2 +- docs/general-development/how-to-get-values-from-ranges.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/general-development/how-to-create-an-odata-data-service-for-use-as-a-bcs-external-system.md b/docs/general-development/how-to-create-an-odata-data-service-for-use-as-a-bcs-external-system.md index bb1c5d9500..cc12c6efa7 100644 --- a/docs/general-development/how-to-create-an-odata-data-service-for-use-as-a-bcs-external-system.md +++ b/docs/general-development/how-to-create-an-odata-data-service-for-use-as-a-bcs-external-system.md @@ -98,7 +98,7 @@ By default, when a WCF service is created, it cannot be accessed due to its secu ### To enable access to data service resources -- In the code for the data service, replace the placeholder code in the **InitializeService** function with the following. +In the code for the data service, replace the placeholder code in the **InitializeService** function with the following. ```csharp config.SetEntitySetAccessRule("*", EntitySetRights.All); diff --git a/docs/general-development/how-to-get-values-from-ranges.md b/docs/general-development/how-to-get-values-from-ranges.md index b7172c9c3e..0b6eec035d 100644 --- a/docs/general-development/how-to-get-values-from-ranges.md +++ b/docs/general-development/how-to-get-values-from-ranges.md @@ -84,7 +84,7 @@ If you are getting values from multiple adjacent cells, you may want to consider Dim rangeResult2() As Object = xlservice.GetCell(sessionId, sheetName, 0, 8, False, outStatus) ``` - 1. Use the **GetRange** method to get values from a range in the open workbook by using numeric range coordinates. +1. Use the **GetRange** method to get values from a range in the open workbook by using numeric range coordinates. ```csharp // Instantiate the Web service and make a status array object. @@ -136,9 +136,9 @@ If you are getting values from multiple adjacent cells, you may want to consider Next x ``` - ### To get values using the GetCellA1 and GetRangeA1 methods +### To get values using the GetCellA1 and GetRangeA1 methods - 1. Use the **GetCellA1** method to get a value from a cell in the open workbook, using the Excel "A1" range specification; for example: +1. Use the **GetCellA1** method to get a value from a cell in the open workbook, using the Excel "A1" range specification; for example: ```csharp // Instantiate the Web service and make a status array object.