Creating apps for SharePoint and project items from templates
Published: July 16, 2012
Learn to develop apps for SharePoint by using new templates for projects and project items in Visual Studio 2012.
Applies to: apps for SharePoint | Office 365 | SharePoint Foundation 2013 | SharePoint Server 2013
You can develop apps for SharePoint by using new templates for projects and project items in Visual Studio 2012. For more information about how to create apps for SharePoint, see Build apps for SharePoint.
When you use a project template in Visual Studio, it creates a solution that contains the project items and files that the project type requires. The following project templates appear in the New Project dialog box if you expand the Office/SharePoint node and then you expand the Apps node. For information about the project templates under the SharePoint Solutions node, see SharePoint Project and Project Item Templates.
App for Office 2013
Creates a webpage that’s hosted inside an Office application, such as Excel or Outlook. An app for Office provides additional content and functionality in a document or Outlook item. For more information, see Overview of apps for Office.
App for SharePoint 2013
Creates an app for SharePoint based on the information that you specify in a wizard. This information includes the following data.
The name of the app.
The local or remote SharePoint site to use for debugging your app.
The type of app that you want to create: autohosted, provider-hosted, or SharePoint-hosted.
For more information, see Project structure and properties of apps for SharePoint in Visual Studio and Apps for SharePoint overview.
After you create a SharePoint solution, you can add project items to it by using the following templates, which appear in the Add New Item dialog box under the Office/SharePoint node.
App for Office
Adds an app for Office to your app for SharePoint. You can add a task pane app, a content app, or a mail app. For more information, see Overview of apps for Office.
Client Web Part (Host Web)
Adds a client web part to your app for SharePoint. By adding a client web part, you can display apps on the pages of a host site. This template contains a single Elements.xml file, whose properties define the following elements of the client web part.
Specifies the name, the title, the description, and the dimensions of the client web part.
Defines the location of the page that renders inside the client web part. This element has two properties: Type and Src. Type specifies the type of web part that you’re creating, such as HTML. Src defines the location of the page that will render inside the client web part. The template references properties on the query string by using the pattern _PropertyName_, such as Src="~appWebUrl/Pages/ClientWebPart1.aspx?Property1=_property1_"
For more information, see How to: Create app parts to deploy with apps for SharePoint.
Adds a content type to your app for SharePoint, similar to content types that were used in previous versions of SharePoint. A content type is a set of metadata, workflows, and behavior for a category of items in a SharePoint list or library. For example, an item is one type of list content. Other types of list content include announcements, contacts, and tasks, and they inherit from the item content type. The contact content type contains columns such as First Name, Last Name, and Job Title.
When you add a content type to your app for SharePoint, you specify the base content type from which the new content type inherits. For example, it can inherit from an announcement, a contact, a document, or an item content type. You then use the Content Type designer to configure the columns for the content type and its other properties, such as its name and its description. The values that you choose are added to the ContentType and FieldRef elements in the Elements.xml file. For more information, see Building Block: SharePoint 2010 Content Types.
Adds a project item for an empty element to your app for SharePoint. This project item contains a single file, Elements.xml, where you define the properties of the element. You typically use an empty element to define an item for which Visual Studio doesn't provide a template.
Adds two project items to your app for SharePoint: a list definition and an instance of the list. When you add a list to your app, you specify what to name the list and whether to create either a blank list or a list that's based on an existing list type. You also specify whether the list can be customized. Then you use the List Designer to configure the columns and views for the list and other properties, such as the list’s name and description. For more information about list properties, see ListTemplate Element (List Template) and ListInstance Element (List Instance).
Menu Item Custom Action
Adds a project item that extends the UI of its host site by adding an action to a list menu. The menu custom action contains an Elements.xml file, which you use to define the properties of the action. For more information, see How to: Create custom actions to deploy with apps for SharePoint.
Adds a module project item to your app for SharePoint. Modules are basically containers that you can use to include other files when you deploy your app for SharePoint. To add a file, you copy it into the project under the module in Solution Explorer. A reference to the file is automatically added to the Elements.xml file for the module, and the reference specifies the path and URL of the new file. You can delete the Sample.txt file that's included with the module because it's included only for example purposes.
Remote Event Receiver
Adds a project item for a remote event receiver to your app for SharePoint and a web application project to your solution, if such a project isn't already present. The web application contains a web service that's associated with the remote event receiver in your app for SharePoint. The web service contains a Visual Basic or Visual C# code file whose code executes when a list, a list item, or a web item event occurs in the app for SharePoint. If a web application is present, it's associated with the app for SharePoint, and the web service is added to that application. For more information, see Handling events in apps for SharePoint.
Ribbon Custom Action
Adds a project item that extends the UI of its host site by adding an action to a ribbon. The ribbon custom action contains an Elements.xml file, which defines the properties of the action. For more information, see How to: Create custom actions to deploy with apps for SharePoint.
Adds a project item for a site column to your app for SharePoint. The site column contains an Elements.xml file that defines the Field properties of the site column, including the following data.
A unique GUID value for the site column.
A unique name that's used to reference the site column.
A friendly name that appears in the UI.
The data type of the site column based on SPFieldType, such as Boolean, lookup, or text.
If the column is required, the property is set to True; otherwise, the property is set to False.
Specifies the name of the group to which the site column is assigned. The default value for this property is Custom Site Columns.
For more information, see Building Block: Columns and Field Types.
Adds a project item for a Windows Azure workflow to your app for SharePoint. For more information, see Workflows in SharePoint 2013. When you add this type of item, you specify a name for the workflow and whether it's a list or site workflow. As the names suggest, a list workflow works only with a list, and a site workflow works only with the SharePoint site. When you're creating the workflow, you also specify whether to automatically associate the workflow with lists and libraries, and if so, which ones. For every association that you add, a file for it is added to the workflow project. A workflow contains the following files.
Specifies the configuration of the workflow and the files that it contains, such as the workflow.xaml file and association files, and the properties of each file, such as its URL, its type, and its path. For each file that's added to the workflow project, a corresponding section is added to the Elements.xml file for the workflow. Association files in list workflows require a list, so they have a reference to the list token. In a site workflow, a GUID is added for the site.
Represents the designer for the workflow. In this file, you add actions to the workflow and set their code and properties.
Manually starts the workflow on SharePoint. This file is added to the workflow project if you select the A user manually starts the workflow check box in the workflow wizard.
Starts the workflow automatically if one is present when a user creates an item in the site or list (depending on the workflow type). This file is added to the workflow project if you select the The workflow starts automatically when an item is added check box in the workflow wizard.
Starts the workflow automatically, if one is present when a user changes an item in the site or list (depending on the workflow type). This file is added to the workflow project if you select the The workflow starts automatically when an item is changed check box in the workflow wizard.
Represents the file that’s added to the workflow project if you create a history list for the workflow in the workflow wizard.
Represents the file that’s added to the workflow project if you create a task list for the workflow in the workflow wizard.
Workflow Custom Activity
Adds a project item for a workflow custom activity to your app for SharePoint. By adding a workflow custom activity, you can create additional workflow actions that you can then import as custom actions in SharePoint Designer 2013. The workflow custom activity contains an Elements.xml file, which defines the properties of the action, and a .xaml file for the workflow designer. For more information, see Workflows in SharePoint 2013.
July 16, 2012