Visual studio sharepoint

Visual studio sharepoint DEFAULT

Walkthrough: Create a SharePoint application page

An application page is a specialized form of an ASP.NET page. Application pages contain content that's merged with a SharePoint master page. For more information, see Create application pages for SharePoint.

This walkthrough shows you how to create an application page and then debug it by using a local SharePoint site. This page shows all items that each user has created or modified in all sites on the server farm.

This walkthrough illustrates the following tasks:

  • Creating a SharePoint project.
  • Adding an application page to the SharePoint project.
  • Adding ASP.NET controls to the application page.
  • Adding code behind the ASP.NET controls.
  • Testing the application page.


Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Personalize the Visual Studio IDE.


  • Supported editions of Windows and SharePoint.

Create a SharePoint project

First, create an Empty SharePoint Project. Later, you will add an Application Page item to this project.

  1. Start Visual Studio.

  2. Open the New Project dialog box, expand the Office/SharePoint node under the language that you want to use, and then choose the SharePoint Solutions node.

  3. In the Visual Studio Installed Templates pane, choose the SharePoint 2010 - Empty Project template. Name the project MySharePointProject, and then choose the OK button.

    The SharePoint Customization Wizard appears. This wizard enables you to select the site that you will use to debug the project and the trust level of the solution.

  4. Choose the Deploy as a farm solution option button, and then choose the Finish button to accept the default local SharePoint site.

Create an application page

To create an application page, add an Application Page item to the project.

  1. In Solution Explorer, choose the MySharePointProject project.

  2. On the menu bar, choose Project > Add New Item.

  3. In the Add New Item dialog box, choose the Application Page (Farm Solution Only template.

  4. Name the page SearchItems, and then choose the Add button.

    The Visual Web Developer designer displays the application page in Source view where you can see the page's HTML elements. The designer displays the markup for several Content controls. Each control maps to a ContentPlaceHolder control that is defined in the default application master page.

Design the layout of the application page

The Application Page item enables you to use a designer to add ASP.NET controls to the application page. This designer is the same designer used in Visual Web Developer. Add a label, a radio button list, and a table to the Source view of the designer, and then set properties just as you would when you design any standard ASP.NET page.

  1. On the menu bar, choose View > Toolbox.

  2. In the Standard node of the Toolbox, perform one of the following steps:

    • Open the shortcut menu for the Label item, choose Copy, open the shortcut menu for the line under the PlaceHolderMain content control in the designer, and then choose Paste.

    • Drag the Label item from the Toolbox onto the body of the PlaceHolderMain content control.

  3. Repeat the previous step to add a DropDownList item and a Table item to the PlaceHolderMain content control.

  4. On the designer, change the value of the attribute of the label control to Show All Items.

  5. On the designer, replace the element with the following XML.

Handle the events of controls on the page

Handle controls in an application page just as you would any ASP.NET page. In this procedure, you will handle the event of the drop-down list.

  1. On the View menu, choose Code.

    The application page code file opens in the Code Editor.

  2. Add the following method to the class. This code handles the SelectedIndexChanged event of the DropDownList by calling a method that you will create later in this walkthrough.

  3. Add the following statements to the top of the application page code file.

  4. Add the following method to the class. This method iterates through all sites on the server farm and searches for items created or modified by the current user.

  5. Add the following method to the class. This method displays items created or modified by the current user in the table.

Test the application page

When you run the project, the SharePoint site opens and the application page appears.

  1. In Solution Explorer, open the shortcut menu for the application page, and then choose Set as Startup Item.

  2. Choose the F5 key.

    The SharePoint site opens.

  3. On the application page, choose the Modified by me option.

    The application page refreshes and displays all items that you've modified in all sites on the server farm.

  4. On the application page, choose Created by me in the list.

    The application page refreshes and displays all items that you have created in all sites on the server farm.

Next steps

For more information about SharePoint application pages, see Create application pages for SharePoint.

You can learn more about how to design SharePoint page content by using the Visual Web Designer from these topics:

See also

How to: Create an application pageApplication _layouts Page Type


Office and SharePoint development in Visual Studio

You can extend Microsoft Office and SharePoint by creating a lightweight app or add-in that users download from the Office Store or an organizational catalog, or by creating a .NET Framework-based solution that users install on a computer.

In this topic:

Create add-ins for Office and SharePoint

Office 2013 and SharePoint 2013 introduce a new add-in model that helps you build, distribute, and monetize add-ins that extend Office and SharePoint. These add-ins can run in Office or SharePoint Online, and users can interact with them from many devices.

Find out how to use the new Office Add-in model to extend the Office experience for your users.

These add-ins have small footprints compared to VSTO add-ins and solutions, and you can build them by using almost any web programming technology such as HTML5, JavaScript, CSS3, and XML. To get started, use the Office Developer Tools in Visual Studio, which lets you create projects, write code, and run your add-ins in a browser.

Apps for Office and SharePoint conceptual model

Build an Office Add-in

To extend the functionality of Office, build an Office add-in. It's basically a webpage that's hosted in an Office application such as Excel, Word, Outlook, and PowerPoint. Your app can add functionality to documents, worksheets, email messages, appointments, presentations, and projects.

You can sell your app in the Office Store. The Office Store makes it easy to monetize your add-ins, manage updates, and track telemetry. You can also publish your app to users through an app catalog in SharePoint, or on Exchange Server.

The following app for Office shows worksheet data in a Bing map.

Content app for Office

Learn more

Build a SharePoint Add-in

To extend SharePoint for your users, build a SharePoint add-in. It's basically a small, easy-to-use, stand-alone application that solves a need for your users or business.

You can sell your app for SharePoint in the Office Store. You can also publish your add-in to users through an add-in catalog in SharePoint. Site owners can install, upgrade, and uninstall your add-in on their SharePoint sites without the help of a farm server or site collection administrator.

Here's an example of an app for SharePoint that helps users manage business contacts.

Business contact manager app for SharePoint

Learn more

Create a VSTO Add-in

Create a VSTO add-in to target Office 2007 or Office 2010, or to extend Office 2013 and Office 2016 beyond what's possible with Office add-ins. VSTO add-ins run only on the desktop. Users have to install VSTO add-ins, so they're typically more difficult to deploy and support. However, your VSTO add-in can be integrated more closely with Office. For example, it can add tabs and controls to the Office Ribbon and perform advanced automation tasks such as merging documents or modifying charts. You can leverage the .NET Framework and use C# and Visual Basic to interact with Office objects.

Here's an example what a VSTO add-in can do. This VSTO add-in adds Ribbon controls, a custom task pane, and a dialog box to PowerPoint.

PowerPoint Add-in solution

Learn more

Create a SharePoint solution

Create a SharePoint solution to target SharePoint Foundation 2010 and SharePoint Server 2010, or to extend SharePoint 2013 and SharePoint 2016 in ways beyond what's possible with a SharePoint add-in.

SharePoint solutions require on-premises SharePoint farm servers. Administrators must install them, and because solutions execute in SharePoint, they can affect the performance of the server. However, solutions provide deeper access to SharePoint objects. Also, when you build a SharePoint solution, you can leverage the .NET Framework and use C# and Visual Basic to interact with SharePoint objects.

Learn more

  1. Beast mode clean
  2. Ebay kitchen scales
  3. Hp big sur drivers

Develop SharePoint workflows using Visual Studio

SharePoint supports two primary workflow development environments for authoring workflows: SharePoint Designer and Visual Studio. This article summarizes both and discusses the advantages and disadvantages of each.


SharePoint 2010 workflows have been retired since August 1, 2020 for new tenants and removed from existing tenants on November 1, 2020. If you’re using SharePoint 2010 workflows, we recommend migrating to Power Automate or other supported solutions. For more info, see SharePoint 2010 workflow retirement.

Authoring basics for SharePoint workflows

As with previous versions, Microsoft SharePoint provides two primary workflow development environments for authoring workflows: Microsoft SharePoint Designer and Microsoft Visual Studio. However, what differs from previous versions is that using Visual Studio no longer provides a code-based authoring strategy. Instead, both SharePoint Designer and Visual Studio provide a fully declarative, no-code authoring environment regardless of the development tool you select.


As a complement to authoring workflows in SharePoint Designer, you can also use Microsoft Visio 2013 to structure your workflow logic by using Visio 2013 shapes, and then import your logic into SharePoint Designer 2013. For information about using Visio 2013 to author your workflow logic, see Workflow development in SharePoint Designer and Visio.

Declarative workflows

Let's first be clear what is meant by "declarative" workflows. This term means that instead of being authored in code and then compiled into managed assemblies, the workflow is described (literally) in XAML and then executed interpretively at run time.

The XAML is derived (or inferred) from the workflow building blocks that you manipulate in the Workflow Designer (if using Visual Studio) or SharePoint Designer workflow design surface (or Visio, but more about that later). The building blocks themselves are the visual workflow design objects in the designer toolbox—stages, conditions, actions, events, and so on. The set of tools in the respective toolboxes (Visual Studio or SharePoint Designer) differs somewhat, but the concept of the declarative workflow remains the same.

Decision tree: SharePoint Designer vs. Visual Studio

Among the greatest advantages of the workflow framework in SharePoint is the ease with which information workers can use the no-code environment of SharePoint Designer to create rich and powerful workflows. Additionally, a high degree of flexibility and customization is available in a declarative authoring environment such as Visual Studio.

Both of these workflow authoring environments—SharePoint Designer and Visual Studio—offer specific advantages and disadvantages. In this section, we explore how to determine which authoring environment best suits your workflow development needs.

Using SharePoint Designer

  • Target users: Information workers, business analysts, SharePoint developers.
  • Difficulty level: Familiarity with SharePoint Designer, including the core workflow components, such as stages, gates, actions, conditions, and loops.

With SharePoint Designer, users can create a workflow that is attached to a list, library, or site using a no-code, text-based designer. Or, they can use the new visual design environment in which graphical elements are arranged on a design surface to represent the logical flow of a business process. SharePoint Designer excels at enabling rapid workflow development by non-technical workers.

Using Visual Studio

  • Target users: Intermediate or advanced software developers.
  • Difficulty level: Familiarity with Visual Studio, including software development concepts such as event receivers, packaging and deployment, and security.

Authoring workflows in Visual Studio provides flexibility to create workflows to support virtually any business process, regardless of its complexity, and allows debugging and reuse of workflow definitions. Perhaps most important, Visual Studio lets developers include SharePoint workflows as part of a broader SharePoint solution or SharePoint Add-in.

Visual Studio enables developers to create custom actions for consumption by SharePoint Designer, and provides the means to execute custom logic. With Visual Studio, developers can also create workflow templates, which can be deployed to multiple sites.

Comparing SharePoint Designer with Visual Studio

The following table provides a side-by-side comparison of the features and requirements for using SharePoint Designer and Visual Studio to create SharePoint workflows.

Table 1. Workflow authoring tool comparison

Feature / RequirementSharePoint DesignerVisual Studio
Allows rapid workflow developmentYesYes
Enables reuse of workflowsA workflow can be used only by the list or library on which it was developed. However, SharePoint Designer provides reusable workflows that can be used multiple times within the same site.A workflow can be written as a template so that after it is deployed, it can be reused and associated with any list or library.
Allows you to include a workflow as part of a SharePoint solution or SharePoint Add-inNoYes
Allows you to create custom actionsNo. However, SharePoint Designer can consume and implement custom actions that are created and deployed by using Visual Studio.Yes. However, be aware that in Visual Studio, the underlying activities, not their corresponding actions, are used.
Allows you to write custom codeNoNo Note: This is changed from previous versions. In SharePoint, workflows are declarative only and Visual Studio relies on the visual design surface for workflow development.
Can use Visio Professional to create workflow logicYesNo
DeploymentDeployed automatically to list, library, or site on which they were created.Create a SharePoint solution package (.wsp) file and deploy the solution package to the site (SPWeb).
One-click publishing available for workflowsYesYes
Workflows can be packaged and deployed to a remote serverYesYes
DebuggingCannot be debugged.Workflow can be debugged by using Visual Studio.
Can use only actions that are approved by site administratorYesYes Note: This is changed from previous versions. Previously, workflows and actions that were authored by using Visual Studio were code-based and deployed at the farm scope, so administrator approval was not required.

Developing workflows using Visual Studio

Unlike earlier versions, workflows in SharePoint are entirely declarative. Built now on Windows Workflow Foundation 4, Visual Studio provides a visual workflow designer surface that lets you create custom workflows, workflow templates, forms, and custom workflow activities entirely in the designer environment. Your workflow is then packaged and deployed as a SharePoint Feature. For information about Feature packaging, see Using Features in SharePoint Foundation.

Perhaps the most significant change for Visual Studio developers is that custom workflows are no longer compiled and deployed as .NET Framework assemblies. Furthermore, SharePoint no longer uses Microsoft InfoPath forms; instead, forms generation relies on Microsoft ASP.NET forms.

Finally, the Visual Studio workflow project templates have changed. Whereas formerly templates for state machine and sequential workflows were provided, these distinctions are no longer meaningful. Rather, Visual Studio project templates are available in the Visual Studio build provided on your virtual machine (VM).

Enabling on-premises workflow debugging

To debug on-premises workflows in Visual Studio, you need to temporarily allow the Workflow Manager Tools to access your system through the firewall.

  1. In Control Panel, choose System and Security, Windows Firewall.
  2. In the Control Panel Home list, choose the Advanced Settings link.
  3. In the left pane of Windows Firewall, choose Inbound Rules.
  4. In the Inbound Rules list, choose Workflow Manager Tools 1.0 for Visual Studio 2012 - Test Service Host.
  5. In the Actions list, choose Enable Rule.
  6. On the properties page of your SharePoint project, choose the SharePoint tab, and then select the Enable Workflow debugging check box.

Debugging SharePoint Online workflows using Visual Studio

To debug SharePoint Online workflows in Visual Studio, perform the following steps:

  1. If you're behind a firewall, you may need to install a proxy client (such as the Forefront Threat Management Gateway (TMG) Client), depending on your company's network topology.

  2. Register for a Microsoft Azure account if you haven't already, and then sign into that account.

    For information about how to register for a Microsoft Azure account, see Microsoft Azure.

  3. Create a Microsoft Azure Service Bus namespace, which you can use to debug remote workflows. You can do this on the Microsoft Azure portal.

    For more information about the Microsoft Azure Service Bus, see Create a Service Bus namespace using the Azure portal.


    SharePoint Online workflow debugging uses the Relay Service component of the Microsoft Azure Service Bus, so you'll be charged for using the Service Bus. See Service Bus Pricing FAQ. You get free access to Microsoft Azure each month that you subscribe to Visual Studio Professional with MSDN, Visual Studio Premium with MSDN, or Visual Studio Ultimate with MSDN. With this access, you can use the Service Bus relay for 1,500, 3,000, or 3,000 hours, depending on your MSDN subscription. See Get some amount of Microsoft Azure Services each month at no additional charge.

  4. In Microsoft Azure, choose your service namespace, choose the Access Key link, and then copy the text in the Connection String box.

  5. On the properties page of your SharePoint Add-in project, choose the SharePoint tab, and then select the Enable Workflow debugging check box.

    You must enable this feature to debug workflows in SharePoint Online. This property applies to all of your SharePoint projects in Visual Studio. Visual Studio automatically turns off workflow debugging if you package your app for distribution on the Office store.

  6. Select the Enable debugging via Microsoft Azure Service Bus check box. Then, in the Microsoft Azure Service Bus connection string box, paste the connection string that you copied.

After you enable workflow debugging and provide a valid connection string for the Microsoft Azure Service Bus, you can debug SharePoint Online workflows.


If you haven't disabled workflow debugging and don't want to receive a notification whenever your project contains a workflow, clear the Notify me if Microsoft Azure Service Bus debugging is not configured check box.

See also

A great deal of developing SharePoint workflows remains unchanged for the Visual Studio developer. The key sections of the documentation for SharePoint 2010 remain relevant:

Replacing SharePoint Designer with Visual Studio Code - Part 1 - Setting up the Environment

Get started creating SharePoint-hosted SharePoint Add-ins

SharePoint-hosted add-ins are one of the two major types of SharePoint Add-ins. For an overview of SharePoint Add-ins and the two different types, see SharePoint Add-ins. Here's a summary of SharePoint-hosted add-ins:

  • They contain SharePoint lists, web parts, workflows, custom pages, and other components, all of which are installed on a subweb, called the add-in web, of the SharePoint website where the add-in is installed.
  • The only code they have is JavaScript on custom SharePoint pages.

In this article, you'll complete the following steps:

  • Set up your dev environment
  • Create the add-in project
  • Code your add-in
  • Run the add-in and test the list

Set up your dev environment

There are many ways to set up a development environment for SharePoint Add-ins. This section explains the simplest way.

Get the tools

For Visual Studio 2017, installing the Microsoft Office Developer Tools should be done through the Visual Studio 2017 Installer, which can be accessed from the New Project window.

Reference earlier versions of Visual Studio or other Visual Studio documentation.

Sign up for an Office 365 developer subscription


You might already have access to an Office 365 developer subscription:

To get an Office 365 plan:

Open your developer site

In a browser, navigate to the SharePoint site collection you created when you setup your Office 365 developer subscription. (If you don't have a site, follow the instructions here). You should see a site that looks like the one in the following figure. The Apps / Add-ins in Testing list on the page confirms that the website was made with the SharePoint Developer Site template. If you see a regular team site instead, wait a few minutes and then restart your site.


Make a note of the site's URL; it's used when you create SharePoint Add-in projects in Visual Studio.

Your developer site home page with the Apps / Add-ins in Testing list

Screenshot that shows the developer site homepage.

Create the add-in project

  1. Start Visual Studio by using the Run as administrator option.

  2. In Visual Studio, select File > New > New Project.

  3. In the New Project dialog box, expand the Visual C# node, expand the Office/SharePoint node, and then select Add-ins > Add-in for SharePoint.

  4. Name the project EmployeeOrientation, and then select OK.

  5. In the Specify the Add-in for SharePoint Settings dialog box, provide the full URL of the SharePoint site that you want to use to debug your add-in. This is the URL of the developer site. (Use HTTPS, not HTTP in the URL.) Under How do you want to host your SharePoint Add-in, select SharePoint-hosted, and then select Finish.

  6. You may be prompted to sign in to your developer site. If so, use your subscription administrator's credentials.

  7. After the project is created, open the file /Pages/Default.aspx from the root of the project. Among other things, this generated file loads one or both of two scripts that are hosted on SharePoint: sp.runtime.js and sp.js. The markup for loading these files is in the Content control near the top of the file that has the ID PlaceHolderAdditionalPageHead. The markup varies depending on the version of Microsoft Office Developer Tools for Visual Studio that you are using. This series of tutorials requires that both files be loaded and that they be loaded with ordinary HTML <script> tags, not <SharePoint:ScriptLink> tags.

    Ensure that the following lines are in the PlaceHolderAdditionalPageHead control, just above the line :

  8. Search the file for any other markup that also loads one or the other of these files and remove the redundant markup. Save and close the file.

Code your add-in

For your first SharePoint-hosted SharePoint Add-in, we'll include the classic SharePoint extension: a custom list and list instance.

  1. In Solution Explorer, open the AppManifest.xml file.

  2. When the manifest designer opens, add a space between the words in the Title field so that it reads Employee Orientation. (Do not change the Name field.)

  3. Save and close the file.

  4. Right-click the project in Solution Explorer and select Add > New Folder. Name the folder Lists.

  5. Right-click the new folder and select Add > New Item. The Add New Item dialog opens to the Office/SharePoint node.

  6. Select List. Give it the name NewEmployeeOrientation, and then select Add.

  7. On the Choose List Settings page of the SharePoint Customization Wizard, leave the list display name at the default NewEmployeeOrientation, select the Create a customizable list template and a list instance of it option button, select Default (Custom List) on the drop-down list, and then select Finish.

  8. The wizard creates a NewEmployeeOrientation list template with a child list instance named NewEmployeeOrientationInstance. A list designer may open. It is used in a later step.

  9. Expand the NewEmployeeOrientationInstance node in Solution Explorer, if it isn't already, so that you can clearly distinguish the elements.xml file that is a child of the list instance from the elements.xml file that is a child of the list template.

    List folder with child NewEmployeeOrientation template, which itself has three children; a NewEmployeeOrientationInstance, an elements.xml file, and a schema.xml file. The instance itself has a child named elements.xml.

  10. Open the elements.xml child of the NewEmployeeOrientation list template.

  11. Add spaces to the DisplayName attribute (not the Name attribute) to make it friendlier: "New Employee Orientation."

  12. Set the Description attribute to "Orientation information about new employees."

  13. Leave all other attributes at their default, save the file, and close it.

  14. If the list designer is not open, select the NewEmployeeOrientation node in Solution Explorer.

  15. Open the List tab of the designer. This tab is used to set certain values for the list instance, not the list template, but it has some default values that it inherited from the template.

  16. Change the values on the List tab to the following:

    • Title: New Employees in Seattle
    • List URL: Lists/NewEmployeesInSeattle
    • Description: The new employees in Seattle
  17. Leave the check boxes at their default status, save the file, and then close the designer.

  18. The list instance may have its old name in Solution Explorer. If so, open the shortcut menu for NewEmployeeOrientationInstance, select Rename, and change the name to NewEmployeesInSeattle.

  19. Open the schema.xml file.

  20. In the View element whose BaseViewID value is "0", replace the existing ViewFields element with the following markup (use exactly this GUID for the FieldRef named ). Line breaks may come at odd places in this autogenerated schema.xml file. Be sure you have found the matching begin and end tags for the ViewFields element. Add line breaks to improve readability.

  21. Still in the schema.xml file, in the View element whose BaseViewID value is "1", replace the existing ViewFields element with the following markup (use exactly this GUID for the FieldRef named ).

  22. Save and close the schema.xml file.

  23. Open the elements.xml file that is a child of the list instanceNewEmployeesInSeattle (not the elements.xml that is a child of the list templateNewEmployeeOrientation).

  24. In this file, populate the list with some initial data. You do this by adding the following Data element markup as a child element of the ListInstance element.

  25. Save and close the file.

  26. In Solution Explorer, double-click Feature1 to open the Feature designer. In the designer, set the Title to New Employee Orientation Components and set the Description to Lists and other components for getting employees oriented to the company. Save the file, and then close the designer.

  27. If the Feature1 in Solution Explorer has not been automatically renamed, open its shortcut menu, select Rename, and rename it to NewEmployeeOrientationComponents.

  28. Open the Default.aspx file.

  29. Find the ASP.NET Content element with the ID PlaceHolderPageTitleInTitleArea. Replace the default string Page Title with New Employees by Location.

  30. Find the ASP.NET Content element with the ID PlaceHolderMain. Replace its contents with the following markup. The is a JavaScript object that SharePoint automatically includes on the page. It's property returns the URL of the add-in web.

  31. Use the F5 key to deploy and run your add-in. Visual Studio makes a temporary installation of the add-in on your test SharePoint site and immediately runs the add-in. (To find out how end users run an installed SharePoint Add-in, see Next steps.)

  32. When the add-in's default page opens, select the New Employees in Seattle link to open the custom list instance.

    The add-in's default page is shown with its title New Employees by Location. There is a link labeled New Employees in Seattle. An arrow from this link points to the list view page for the list. It is titled New Employees in Seattle, with the list below.

  33. Add and delete items from the list.

  34. To end the debugging session, close the browser window or stop debugging in Visual Studio. Each time that you press F5, Visual Studio will retract the previous version of the add-in and install the latest one.

  35. You will work with this add-in and Visual Studio solution in other articles, and it's a good practice to retract the add-in one last time when you are finished working with it for a while. Right-click the project in Solution Explorer, and select Retract.

Next steps

To create your add-ins, walk through the following steps in this order:

  1. Deploy and install a SharePoint-hosted SharePoint Add-in
  2. Add custom columns to a SharePoint-hosted SharePoint Add-in
  3. Add a custom content type to a SharePoint-hosted SharePoint Add-in
  4. Add a web part to a page in a SharePoint-hosted SharePoint Add-in
  5. Add a workflow to a SharePoint-hosted SharePoint Add-in
  6. Add a custom page and style to a SharePoint-hosted SharePoint Add-in
  7. Add custom client-side rendering to a SharePoint-hosted SharePoint Add-in
  8. Create a custom ribbon button in the host web of a SharePoint Add-in
  9. Use the SharePoint JavaScript APIs to work with SharePoint data
  10. Work with host web data from JavaScript in the add-in web


View all page feedback


Sharepoint visual studio


How to develop a SharePoint workflow using visual studio


Similar news:


1407 1408 1409 1410 1411