Muokkaa

Jaa


Create an add-in-scoped external content type in SharePoint

Learn how to create external content types that can be installed, secured, and used in an SharePoint Add-in.

Prerequisites for developing add-in-scoped external content types

To get started developing add-in-scoped external content types, you need the following:

  • SharePoint

  • Visual Studio 2012

  • Office Developer Tools for Visual Studio 2012

  • A published OData service available through the Internet

For information about setting up a SharePoint development environment, see Set up a general development environment for SharePoint.

Create an add-in-scoped external content type

The following steps show how to create an external content type based on an Open Data protocol (OData) source, and how to modify it to be scoped to your SharePoint Add-in.

To create a new SharePoint Add-in

  1. Open Visual Studio 2012.

  2. Create an Add-in for SharePoint project.

  3. Specify the add-in settings, including add-in name, the site URL for debugging the add-in, and how you would like to host the add-in (Autohosted, Provider-hosted, or SharePoint-hosted). For more information, see Choose patterns for developing and hosting your SharePoint Add-in.

  4. Choose Finish to create the app.

For complete steps for creating SharePoint Add-ins, see the following:

To generate the external content type

  1. In Solution Explorer, open the shortcut menu for the project, and choose Add, Content types for External Data source.

    This starts a wizard that helps you find the selected data source and create the BDC model.

  2. On the Set OData Source page, enter the URL of the OData service that you want to connect to. The URL should look something like this: http://services.odata.org/Northwind/Northwind.svc/.

    Specify a name for your OData source.

    Note

    For this example, you will use the Northwind service that is available from the producers list located on the Open Data Protocol website.

  3. A list appears showing data entities that are being exposed by the OData Service. Select one or more of the entities, and choose Finish.

To deploy the add-in-scoped external content type

  • Press F5 to compile the project and upload the project files to SharePoint.

See also