New SharePoint Developer Tools in Visual Studio 2012

Post on 20-Aug-2015

275 views 2 download

Tags:

Transcript of New SharePoint Developer Tools in Visual Studio 2012

New SharePoint Developer Tools in Visual Studio 2012Jeremiah WalkerSharePoint Consultantjeremiahw@imaginet.com

Session Goals:• Introduce new SharePoint object designer tools in

Visual Studio 2012• Create a SharePoint 2013 solution in Visual Studio

2012.• Walk through new wsp packaging process for Visual

Studio 2012.  • Use deployed solution in SharePoint 2013 with

custom content objects.

Booth #417 www.imaginet.com info@imaginet.com

SharePoint Development Tools in Visual Studio 2012

There are many new tools in Visual Studio 2012 to help increase developer productivity. As we review the new tools for SharePoint development and how they increase developer productivity the common theme that begins to surface is ……..

DESIGNERS, DESIGNERS !!!!!!!

SharePoint development in Visual Studio 2010 involved creation of SharePoint objects and then defining the properties and attributes of those SharePoint objects using declarative XML in an Elements or Manifest file.

Elements.xml

In Visual Studio 2012 this is replaced with Wizard style tabbed designers that generate the Elements.xml.

Types of Designers:In Visual Studio 2012 we are introduced to 2 new SharePoint object Designers.

Content Type Designer

List Designer

Content Type DesignerAllows you to design a content type using custom columns developed in the current Visual Studio solution or existing Site Columns from the SharePoint dev environment. The properties of the Content Type are also set in the new Content Type Designer.

List DesignerAllows you to design a SharePoint list using custom content types developed in the current Visual Studio solution or from the SharePoint dev environment. You can also assign individual columns to the list from the Designer.

Click the Content Type button. This will display the Content Type Settings window. From this window you can manage the existing content types and add additional content types including content types from the solution.

List Designer Cont.

Click the Views tab on the List Designer. This will display the default View for the list and the columns displayed in the View.

The List Designer also allows definition of properties of the List.

Other Tools in Visual Studio 2012In Visual Studio 2012 not only do we have the introduction of the Designer tools there is also the added Project level properties for Site URL and Server Connection status!!!

Tell the status of your SharePoint dev environment right from Visual Studio.

Other Tools Cont.The Visual Studio Project Templates have been updated to make the new SharePoint 2013 App project template available in Visual Studio 2012.

Office Tools

http://aka.ms/OfficeDevToolsForVS2012

To enable the SharePoint 2013 project templates the Office Developer tools SDK for Visual Studio 2012 must be downloaded and installed.

Time to Build ???How can we use these tools to quickly build a SharePoint solution??

We will utilize the new Designer Tools in Visual Studio 2012 to define a new Work Order application.

The Work Order application will have a Work Order list that Associates to a Work Order Items list. The Work Order Items List will display Services available to be performed on a Work Order.

Work Order Application Overview:The Work Order application will consist of Site Columns, Content Types and Custom Lists.

The Work Order list will contain Work Orders that relate to a Work Order Items list.

The Work Order Items List will display Service Offerings available to be performed on a Work Order.

The Service Offerings list will list the available Service Offerings.

WorkOrder Demo Detailed TasksCreate an empty SharePoint Project

Create new Site Columns for the Work Order Demo SolutionCreate a new Content Types for the Work Order Demo SolutionCreate a new Lists for the Work Order Demo SolutionAdd Site Columns, Content Types and Lists to WorkOrder FeatureAdd WorkOrder Feature to Package

WorkOrder Demo Tasks Cont.Create wsp solution file from Package

Add wsp solution to Central AdministrationDeploy wsp solution to Site CollectionActivate Feature in Site CollectionCreate new items in Work Order Demo Solution lists

SharePoint 2013 Developer Workstation Requirements.

x64-capable CPU16 GB of RAM; 24 GB of RAM is preferable.Windows Server 2012, Windows Server 2008 R2 Service Pack 1 x64. Or use Microsoft Hyper-V and install SharePoint 2013 on a virtual machine running a Windows Server 2008 R2 Service Pack 1 x64 or Windows Server 2012 guest operating system. Visual Studio 2012 Ultimate or Professional editionOffice Developer Tools for Visual Studio 2012SharePoint Client ComponentsAsp.NET and Web Tools 2012.2

Open Visual Studio 2012. On the start page click New Project.

This will present the New Project window which lists available project templates for Visual Studio.

In the left page of the New Project window expand the Templates section then expand Office/SharePoint and click on SharePoint solutions.

This will display the available SharePoint project templates. Select SharePoint 2013 - Empty Project.

Enter WorkOrderDemo for the project name and the solution name. Then click OK.

This will display the SharePoint Customization Wizard. Enter the url of your SharePoint site. Select Deploy as a Farm Solution. Then click Finish.

Visual Studio will create a solution with a Features folder and a Package folder.

Right click on your project and select New Folder. Name the folder WorkOrderColumns. Add 2 more folders for WorkOrderContentTypes and WorkOrderLists.

Right click on the WorkOrderColumns folder. Select Add then select New Item. This will display the Add New Item window.

In the Add New Item window select Site Column and enter ServiceOfferingName in the Name field. Then click Add.

Right click on the WorkOrderColumns folder and add another Site Column named ServiceOfferingPrice. You should now have the 2 columns in the WorkOrderColumns folder.

Open the elements.xml file for the ServiceOfferingPrice column. Set the Type property to “Currency”. Add properties of Decimals=“2”, Min=“0”, Required=“TRUE”, Group=“WorkOrder Columns”.

Open the elements.xml file for the ServiceOfferingName column. Change the property of Group to Group=“WorkOrder Columns”.

Right click on the WorkOrderContentTypes folder. Select Add then select New Item. In the Add New Item window select Content Type.

Enter ServiceOffering for the Content Type Name then click Add.

This will display the SharePoint Customization window. Select Item as the base content type and click Finish.

This will display the Content Type Designer window. Add the ServiceOfferingName and ServiceOfferingPrice columns to the content type.

Click the Content Type tab in the Content Designer Window. Update the display name for the Content Type. Set the group name as WorkOrder Content Types and uncheck the Inherit from Parent Content Type check box. Save the Content Type.

Right click on the WorkOrderLists folder and select Add then select New Item. From the Add New Item window select List. Set the Name to ServiceOfferings then click Add.

This will display the SharePoint customization window. Set the name to Service Offerings. Then click Finish.

This will display the SharePoint List Designer window. Delete the Title Column then Click the Content Type button. This will display the Content Type Settings window.

Add the ServiceOffering content type and delete the 2 existing content types. Then click OK.

The list has now been updated with the columns from the Content Type.

Click on the Views tab in the Content Type Designer window.

This will display the default View for the list and the columns displayed in the View.

In the Selected Columns pane select Title and click the Left Arrow to remove the Title column from the default View. Then click the List tab in the SharePoint List Designer window.

This will display the List settings page. Remove the space in the Relative URL value. Then save the list.

Repeat these steps to create the Site Columns and Content Types for a WorkOrders and WorkOrderItems Lists.

The WorkOrder Content Type will have the following columns:

The WorkOrderItem Content Type will have the following columns:

To Create the 2 Lookup Type columns on the WorkOrderItem Content Type set the following properties of the Site Column.

The WorkOrderItemService Column will Lookup data on the ServiceOfferings list. Set the below properties to configure this look up.

The WorkOrderItemWorkOrderId Column will Lookup data on the WorkOrders list. Set the below properties to configure this look up.

Once all Site Columns, Content Types and Lists are created expand the Features folder then open the Features1 feature. This will display the Feature Designer Window.

Change the Title to WorkOrderFeature. Set the scope to Site. Click the double right arrow to add the existing solution items to the Feature.

In the Solution Explorer right click on Feature1 and select rename. Rename the Feature to WorkOrderFeature then click Enter. Then save the Feature.

Expand the Package folder then double click on Package.package This will open the SharePoint Package Designer window. Ensure the name is WorkOrderDemo.

In the Package Designer ensure the Feature is in the Items in the Package pane. Then save the Package.

In the solution explorer right click on the Project and select Build. Once the build is successful right click on the Project and select Publish. This will display the Publish window. Set the Publish location to c:\publish. You will have to create this folder. Then click Publish.

When Package is completed the status in the lower left corner of Visual Studio will display Publish succeeded.

Open the C:\Publish folder in Windows explorer to view the .wsp file.

From the Windows Server 2012 Home Screen open SharePoint Management Shell as an Administrator. Enter the below PowerShell command to add the wsp Solution to SharePoint.

Once added to SharePoint PowerShell will display this result.

Open Central Administration then click on System Settings.

This will display the System Settings page. In the Farm Management section click on Manage farm solutions.

This will display the existing Farm Solutions if any.

Click on WorkOrderDemo solution name. This will display the Solution Properties page. From this page the solution can be deployed to the Site Collection.

Click Deploy Solution. This will display the Deploy Solution page. Leave the settings as default and click OK.

This will display the Solution Management page again and the status of the solution will be Deployed.

Open the SharePoint site in the browser and navigate to the Site Settings page.

In the Site Collection Administration section click Site Collection Features. This will display all existing Site Collection Features. Ensure the WorkOrderFeature is Active.

Navigate to the Site Contents page of the SharePoint site.

In the Site Collection Administration section click Site Collection Features. This will display all existing Site Collection Features. Ensure the WorkOrderFeature is Active.

Navigate to the Site Contents page of the SharePoint site.

Ensure the ServiceOfferings, WorkOrders and WorkOrderItems list apps are displayed on the Site Contents page. If not add them from the Add an App page.

Click on the ServiceOfferings list app to navigate to the list.

This will display the ServiceOfferings list app. On the ServiceOfferings list app click the Items tab then click New Item to create a new Service Offering.

Enter the Service Offering Name and Service Offering Price then click Save.

This will display the Service Offering just created.

Navigate to the WorkOrders list and add an Item then navigate to the WorkOrderItems list to add an item that looks up data from the ServiceOffering and WorkOrders lists.

This completes the tasks for creating a Custom Site Column, Custom Site Content Type, Custom SharePoint List, SharePoint Feature, SharePoint package and a SharePoint .wsp Solution file in Visual Studio. Then adding the .wsp Solution file to SharePoint, deploying the .wsp Solution file to a Site Collection then creating an item of the Content Type in the custom SharePoint list.

Imaginet would like to give your organization an opportunity to enter to win one week of free SharePoint Consulting. In order to enter we need more information on the project.

• Company Name:• Key Stakeholder:• Engagement Contact Information: • Description of Business Challenge:• Key Considerations:• Desired Outcome:• Is this a budgeted project? If so, what is the

budget?• Preferred Engagement Timeline:

Please provide the above information to sharepointcontest@imaginet.com by April 30th,2013 to enter.*

Business Intelligence

Enterprise Content Management

User Experience and Design

Custom Applications

Windows Azure

Free SharePoint Consulting Services:

*Travel and Expenses are not included*Engagement dates based upon Imaginet availability

SharePoint TechFest Booth - 417

Web Site – www.imaginet.com/sharepoint

Imaginet Blog – blog.imaginet.com

Twitter - @justimaginet

Facebook – www.facebook.com/justimaginet

Email – info@imaginet.com

Want to know more…?