SharePoint Hello World Web Part

Source: Internet
Author: User

1. Create a new C # class library.

2. Add system. Web refeerence.

3. AddCode

Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. text;

Using system. Web. UI;

Namespace helloworldwebpart
{
Public class myfirstwebpart: system. Web. UI. webcontrols. webparts. webpart
{
Protected override void render (htmltextwriter writer)
{
Writer. Write ("Hello World");
}
}
}

4. Modify project properties

Add a key. SNK to the project properties.

5. Modify assemblyinfo. CS and add the following code:

Using system. Security;

[Assembly: allowpartiallytrustedcallers]

6. recompile the DLL and copy the above DLL to: C: \ Inetpub \ wwwroot \ WSS \ virtualdirectories \ 26864 \ _ app_bin to modify the web. config, add the following code (using the refactor tool ):

7. Deploy the generated DLL to SharePoint. Select create.

8. Select "Web parts", select "new", select the Web part to be added, and click "populate Gallery ".

9. Select "Edit page" on a page and add the corresponding web part.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.