Commands For “Add”, “Install”, “Update” The Solutions For SharePoint Site

In my last article, we saw how to create a SharePoint farm solutions project. After we have completed the project development, we can deploy the WSP to the SharePoint Server. WSP will be available after we publish the project in Visual Studio.

Steps to Add, Install and Update the WSP

Follow the below listed steps to deploy the WSP in SP Server.

Step 1

Open the SharePoint Management Shell with administrator rights in Server.

SharePoint

ADD Solution

Now, add the WSP solution first using the below command,

Add-SPSolution “Documents\Your WSP Name.wsp”

E.g

Add-SPSolution “C:\Workings\AE_WSP\SampleSPProject.wsp”

SharePoint

Open the Central Admin and go to System Settings from the left navigation. Now, select “Manage Farm Solutions” to check the status of your solution.

SharePoint

INSTALL SP solution

Then, install the WSP to the WebApplication by running following command in Management Shell,

Install-SPSolution –Identity “WSP Name”.wsp –WebApplication “Site Url” –GACDeployment -fulltrustbindeployment -force

E.g

Install-SPSolution –Identity “SampleSPProject.wsp” –WebApplication “http://test:8888/” –GACDeployment -fulltrustbindeployment -force

SharePoint

Finally, your solution will be deployed successfully. We can check the status in Central Admin, as shown in below image.

SharePoint
UPDATE Solution

If we want to update the solution, we can use the below command in PowerShell to update the previous solution,

Update-SPSolution -Identity “WSPNAME.wsp” -LiteralPath “PATHFORWSP\SampleSPProject.wsp” -GACDeployment -FullTrustBinDeployment -Force

E.g

Update-SPSolution -Identity “SampleSPProject.wsp” -LiteralPath “C:\Workings\AE_WSP\SampleSPProject.wsp” -GACDeployment -FullTrustBinDeployment –Force

SharePoint

In Central Admin’s “Manage Farm Solutions, we can check the status, as shown below.

SharePoint

Finally, our solution will be updated successfully.

SharePoint

UNINSTALL solution

Run the below command to uninstall the WSP in Management Shell.

Uninstall-SPSolution -Identity “wspname.wsp”

E.g

Uninstall-SPSolution -Identity “SampleSPProject.wsp”

When you uninstall the WSP it ensure that to perform this operation as shown below, type “Y” to proceed,

SharePoint

REMOVE Solution

Use the below command to remove the WSP solution.

Remove-SPSolution –Identity “SampleSPProject.wsp” -force

SharePoint

Summary

In this article, we have explored how to add, install, update, remove and uninstall the WSP package in SharePoint 2016 server.

Create Document Library With Folders In SharePoint Using VS 2015

In this article, I would like to share the steps for creating a document library with folders in SharePoint, using Visual Studio 2015. In my previous article, we saw how to create document library manually in SharePoint Online Site.

What a SharePoint Document Library is –

  • A Document Library is a collection of files that you can share as documents with your team members.
  • A Document Library stores the files and you can maintain the data in various folders.
  • A SharePoint Document Library is a place on a site where you can create, collect, and update files with others.
  • You can set the permission to each Document Library for the users.
  • You can show a Document Library in web part pages as List View Web Parts.

SharePoint provides templates for us to create SharePoint list and library. Each and every list will have its own list instance and list definition. In Visual Studio SharePoint projects, we can see the list instance, and the folders can be added in the list instance.

Follow the below listed steps to create Library with folders.

Already we saw how to create the SharePoint project using Visual Studio 2015.

Step 1

Open your SharePoint project in VS 2015.

SharePoint

Step 2

Then, create a subfolder under this project to keep the list and libraries separate. Right click the project and choose Add >> New Folder.

SharePoint

Step 3

Provide the folder name as per your need.

SharePoint

Step 4

Right click on the library folder and select Add >> New item….

SharePoint

Step 5

When you click the “New Item”, you will get a pop up as shown below. Here,  select the list template and provide a name for your library.

SharePoint

Step 6

Then, press “Add” button to create a new library.

SharePoint

Step 7

After you click the “Add” button, you need to provide library name and template. I have selected picture library template. Then, click “Finish” button.

SharePoint

Finally, the library will be added in our SharePoint project.

SharePoint

Now, we need to add the folders inside the library. So, add the below code in sample library element.xml file.

  1. <Data>
  2.       <Rows>
  3.         <Row>
  4.           <Field Name=“ContentTypeId”>0x0120004F994A3C0FF76546A528DA0D4B515898</Field>
  5.           <Field Name=“FileLeafRef”>Images</Field>
  6.           <Field Name=“Title”> Images</Field>
  7.           <Field Name=“FSObjType”>1</Field>
  8.         </Row>
  9.       </Rows>
  10.     </Data>

SharePoint

Once you add the above code, deploy the solution from VS. Your new Library will be created successfully with folder, as shown in below image.

SharePoint
Summary

In this article, we have explored how to create a document library with the predefined folders in SharePoint using Visual Studio 2015.

Create SharePoint Project And Deployment Steps Using Visual Studio 2015

What is SharePoint?

  • SharePoint is a web based document management and collaboration tool.
  • It is used to create the sites, manage permissions, and is highly configurable.
  • Search is one of the main features in SharePoint that is more efficient.

What is Farm Solution?

It is hosted on IIS Worked process i.e. W3WP.exe. It can affect the whole farm when we run the code. IIS application pool will be recycled when we retract or deploy the farm solutions.

Steps to create SP Project using VS Templates

Follow the below listed steps to create a SharePoint project. SharePoint Project Templates are available in VS.

Step 1

Open Visual Studio as administrator.

SharePoint

Step 2

Select File >> New >> Project, as shown below.

SharePoint

Step 3

Then, choose “SharePoint 2016 – Empty Project” from the template list. This template is available under Office/SharePoint – SharePoint Solutions.

SharePoint

Step 4

After selecting the template, provide the name for the project and then select the location of project as per your need.

SharePoint

Step 5

Then, click the “OK” button to create a new SharePoint project.

SharePoint

Step 6

Once you click the OK button, you will get the pop up to choose whether it is sandbox or farm solution. As we are creating the project for on-premise, we can choose the farm solution. Then, click “Finish” button.

Note

Before you proceed, ensure that the URL is valid.

SharePoint

Step 7

Finally, the project has been created successfully.

SharePoint

As per your need, you can create the List, Libraries, Modules, and webpart.

Then, right click the project and select “Deploy” to deploy the project on SharePoint site, as show below.

SharePoint

Summary

In this article, we have explored how to create SharePoint project and how to deploy the farm solution on SharePoint Server using Visual Studio. In the next article, we will see how to create a List/Library in SharePoint project using VS.