Edit and Revert a Page Using SharePoint Designer

In the world of SharePoint there are various types of Professionals:

  1. SharePoint Administrator
  2. SharePoint Developer
  3. SharePoint Architect
  4. SharePoint Designer

All the companies won't be able to accommodate all these Professionals. In such cases an Administrator will do the job of others and vice-versa.

Pages in SharePoint

As you know, each page in SharePoint is constructed using a lot of server-side processing.  Some parts of a page will be in the file system, some come from the content database and there will be a lot of role-specific content too.

The following is the URL of my home page:

http://hp/SitePages/Home.aspx

The following is the URL of my list page:

http://hp/Lists/Expense/AllItems.aspx

SharePoint Designer

We can use SharePoint Designer to edit the page.

Sharepoint designer

The editing operation can include:

  1. Add / Edit / Delete of HTML Code
  2. Add / Edit / Delete of JavaScript Code
  3. Add / Edit / Delete of CSS Code

How to edit the Page

Use the following procedure to create a sample of editing a page.

Step 1: Open SharePoint Designer

Start with Sharepoint designer

Step 2: Open SharePoint Site

Click on the "Open Site" button and enter your Site URL.

Open Sharepoint site

You will get to see the site opened as shown below:

Sharepoint site opened

Step 3: Add the following code

We are trying to edit the AllItems.aspx page of a list named Expense. Some pages won't exist until it is edited for the first time.

Go to the "File" menu and click the "Open" button.

Sharepoint open Page

Enter the URL of the page as in the following:

http://hp/Lists/Expense/AllItems.aspx

Click the "Open" button. You will get the following page in Design Mode.

Page in Design Mode

Click on the "Code View" tab on the bottom. You will see the following code view.

Code View tab

Please note that there are certain area colored in Orange. These areas are coming from the site definition and in order to edit that you can use the "Advanced Mode" button from the tool bar. 

Mode button from the tool bar

Scroll down to the end and enter the following code in the highlighted section.

highlighted Section Code

Save the changes to the file.

Step 4: Test Changes

Refresh your list, thern AllItems.aspx and you can see the change is reflected.

Test Changes

In the same way you can add <script> tags and <style> tags into the HTML pages. There are specific sections you need to study, for advanced manipulations.

I recommend SharePoint Designer Certification or Course to do that.

When to revert the Changes?

We can Revert the changes on scenarios like:

  1. When pages are slow
  2. Page is corrupted

How to revert the Changes?

You can choose "SharePoint Designer" > "Open Site" > "All files".

revert the Changes

In the page that appears on the right, choose "Lists" > "Expense". You will get the following page.

All page option

Click "AllItems" > "Toolbar" > "Reset to site definition".

Save Changes

Confirm the Prompt and Save Changes. Your file is now reverted back.

Summary

In this article we have explored how to Edit and Revert a SharePoint Page using SharePoint Designer.