馃摐 猬嗭笍 猬囷笍

Web development. Introduction

One of the most common and everyday developer tasks for the Sharepoint platform is the development of web parts. This is the most flexible and affordable way to extend the functionality of the platform. Despite the fact that there are enough articles on the development of web parts on the Internet, few people know about all the features and nuances.

Who needs it and why?


When developing a website or an internal corporate portal, programmers strive for code elegance and reuse. You know that Sharepoint is a platform and in order for your solution to be successful - you need to develop additional functionality, be it a news service on the website or complex reporting and workflow systems that will have easy and flexible configuration. So, the main advantages of web parts are reuse and the ability to add \ configure \ use via the web interface by users who may not be developers and may not be generally related to IT. With controls and user controls, this is more difficult.

Web parts are perfectly alienable from your solution and portable.

At the moment, the development trend for Sharepoint is that of all components, controls, etc. Web parts are created and can be added in any combination to any page and configured by the administrator / editor.
')
For example, those web parts that are shown in the figure below can be used in any similar services where you need an archive or subscription, or display information from the list. This is achieved by creating the right properties for the web part, allowing flexible configuration via the web interface.


Basics of the basics


For the development we need

路 Microsoft Visual Studio 2005 or Microsoft Visual Studio 2008

路 Visual Studio Extensions for Windows SharePoint Services 3.0 (for VS2005 or VS 2008 ).

In principle, you can develop without extension by creating a project of the type Class Library . But installing the extension will make new project templates available to you. One of them is for developing web parts.



In order to create a web part, you need to write a class in Visual Studio .Net - a successor from one of the standard web part classes.

Historically, Sharepoint supports two types of web parts.

ASP.NET Web Parts are inherited from the Web Parts class from System.Web.dll. Imported into .webpart files. This is the most recommended option.

Windows SharePoint Services Web Parts - Inherited from the Web Parts class from Microsoft.Sharepoint.dll. Imported to .dwp files. Supported for feedback with Sharepoint v2.

Our first web part might look like this:



In order for a web part to be placed on a page, the page must contain the web part zones, and the master page the web part manager. The Sharepoint page on which you can host web parts is as follows.



Installing a web part on Sharepoint is also not an impossible task. For this you need:

路 Put an assembly with a web part code (.dll file) in the GAC (C: \ Windows \ assembly) or in the bin folder in the IIS website

路 Register web part in web.config



路 Add Sharepoint Web Parts to the library. To do this, go to the site collection in the web parts library and go to the add web part page. If everything was spelled correctly in the web config, you should see the namespace of your web part and you can add it to the library



The basics are done. Step-by-step instructions on how to create a web part can be found here . But that's not all I want to tell you about the web part. Continuation will follow in the next few days.

Source: https://habr.com/ru/post/57992/


All Articles