Delegate controls provide a mechanism for adding ASP.NET user controls. As such, to create, compile, and package custom controls, we will use a Visual Studio solution. In this recipe, we will create the Visual Studio SharePoint project that we will use for this chapter. For simplicity, we will add each subsequent recipe to this single project.
In order to create a custom SharePoint solution with Visual Studio, we will need to have Visual Studio 2012 with the Office Developer Tools or Visual Studio 2013 applications installed on a computer running SharePoint Server 2013. In addition, we will need local computer administrator and SharePoint farm administrator access.
If using PowerShell to deploy the custom SharePoint solution, SharePoint shell access to the SharePoint configuration database in SQL will also be required. Refer to http://technet.microsoft.com/en-us/library/ff607596.aspx for more information on adding a SharePoint shell administrator.
Follow these steps to create a Visual Studio solution for custom-delegate controls:
System.Configuration
and Microsoft.SharePoint.Publishing
. The Microsoft.SharePoint.Publishing
assembly can be found at C:Program FilesCommon FilesWeb Server Extensions15ISAPI
.Controls
. We will use the Controls
folder later in the chapter to store all of our code-only user controls.CONTROLTEMPLATES
folder under the TEMPLATE
folder. We will use the CONTROLTEMPLATES
mapped folder to store all of our ASCX
user controls later in the chapter.CONTROLTEMPLATES
mapped folder with the same name as the project. When working with mapped folders, it is important to place items in a subfolder that is unique. This will alleviate any collisions with files of the same names included with SharePoint or provided by other custom solutions.Layouts
mapped folder, which we will use later in the chapter to store our application page, stylesheets, and JavaScript:Our Controls
folder will act like a folder does in a standard .NET class library to provide organization and namespaces. The CONTROLTEMPLATES
mapped folder will instruct SharePoint to deploy the ASCX
files for our user controls to the appropriate place on the filesystem (C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions15TEMPLATECONTROLTEMPLATES
). The Layouts
mapped folder will instruct SharePoint to deploy our application page, stylesheets, and JavaScript to the appropriate place on the filesystem to allow them to be accessed from the client web browsers (C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions15TEMPLATELAYOUTS
).
3.133.156.251