Archive

Posts Tagged ‘Visual Studio 2010’

Demo of adding SharePoint 2010 Project Items to a project in Visual Studio 2010

This demo video includes a walkthrough of creating a visual webpart using Visual Studio 2010.

Deploying the webpart using the Visual Studio 2010 IDE is also included.

Using Visual Studio 2010 you have project templates.
These templates are known as SharePoint Project Items (SPI).

If you are used to using the VSeWSS tools with Visual Studio 2005 – 2008 then you are already used to the idea of creating projects using templates.

The templates that are included in Visual Studio 2010 include:

Application Page
Business Data Connectivity Model
Content Type
Empty Element
Event Receiver
List Definition
List Definition from Content type
List Instance
Module
Sequential Workflow
State Machine Workflow
User Control
Visual Web Part
Web Part
Workflow Association Form
Workflow Initiation Form

 

Get the Flash Player to see this content.

 

Demo of adding SharePoint 2010 Project items

March 14th, 2010 Neal McFee No comments

Walkthrough 1: Using LINQ to SharePoint from within a Visual web part

Exercise Duration: 10 minutes

Exercise Overview

This example demonstrates how to use the SharePoint LINQ provider to read data from a SharePoint list and render the data using the SPGrid web control. It shows these created in the Visual Web Part designer in Visual Studio 2010.

Task 1: Create a new Empty Project and add a Visual Web Part

1. Open Visual Studio 2010 from the Start | Programs | Visual Studio 2010 menu.

2. Create a new project by using File | New Project.

3. Pick the SharePoint | 2010 templates.

4. From the SharePoint | 2010 templates select the Visual Web Part project template.

5. Use SPLinqSolutionDemo as the name of the project.

6. Use C:\SPHOLs as the location.

7. Press OK to create the project.

image

 

8. When the SharePoint Customization Wizard dialog appears, select the site you want to deploy the Web Part to. Click the Finish button to complete the project creation process.

image

 

9. Within Solution Explorer expand VisualWebPart1 and open VisualWebPart1.webpart.

a. Set the title element to: SPLinqDemoPart Title

b. Set the description element to: SPLinqDemoPart Description

image

 

Task 2: Generate LINQ to SharePoint proxy class to access list data.

1. Start a Visual Studio 2010 Command Prompt from the Start | All Programs | Visual Studio 2010 | Visual Studio Tools |Visual Studio Command Prompt (2010) menu

2. Change the directory to C:\SPHOLS\SPLinqSolutionDemo  

cd C:\SPHOLS\SPLinqSolutionDemo

3. spmetal.exe is a command line tool that can generate C# or VB.NET classes from a SharePoint site’s list definitions. It is similar to wsdl.exe that generates a proxy from a Web Service’s WSDL file. 

4. Run the following command to generate the LINQ proxy code.

spmetal /web:http://<YourServerName> /namespace:Projects /code:Projects.cs

5. Go back to Visual Studio 2010.

6. Right-click on the SPLinqSolutionDemo project in the Solution Explorer and select Add | Existing Item.

7. Browse to C:\SPHOLS\SPLinqSolutionDemo and select the Project.cs file that was generated when you ran spmetal.

8. Right-click on the SPLinqSolutionDemo in the Solution Explorer and select Add Reference.

 

9. Click on the Browse tab, navigate to the C:\Program Files\Common Files\Microsoft Shared\Web Server Extension\14\ISAPI folder, and select Microsoft.SharePoint.Linq.dll and select OK.

 

image

  

Task 3: Write the code for the Visual WebPart User to access the list data.

1. In Visual Studio 2010 open the SPLinqDemoPartUserControl.ascx file from the Solution Folder by double-clicking on it.

2. Add the following markup to SPLinqDemoPartUserControl.ascx under the <%@ Control… declaration

 

<%@ Import Namespace="Microsoft.SharePoint.WebControls" %>

 

<SharePoint:SPGridView id="spGridView" runat="server" AutoGenerateColumns="false">

  <HeaderStyle HorizontalAlign="Left" ForeColor="Navy" Font-Bold="true" />

  <Columns>

    <SharePoint:SPBoundField  DataField="Title" HeaderText="Title"></SharePoint:SPBoundField>

    <SharePoint:SPBoundField DataField="JobTitle" HeaderText="JobTitle"></SharePoint:SPBoundField>

    <SharePoint:SPBoundField DataField="ProjectTitle" HeaderText="ProjectTitle"></SharePoint:SPBoundField>

    <SharePoint:SPBoundField DataField="DueDate" HeaderText="DueDate"></SharePoint:SPBoundField>

  </Columns>

</SharePoint:SPGridView>

 

3. In the Solution Explorer, expand the carat icon next to the SPLinqDemoPartUserControl.asx, and then double-click on the SPLinqDemoPartUserControl.ascx.cs file to open it.

 

image

4. Add the following using statements to SPLinqDemoPartUserControl.ascx.cs  file after the existing using statements.

 

using System.Linq;

using Projects;

using Microsoft.SharePoint;

using Microsoft.SharePoint.Linq;

 

 

5. Add the following code to the SPLinqDemoPartUserControl.ascx.cs  file (replace the existing Page_Load method).

 

protected void Page_Load(object sender, EventArgs e)

{

    ProjectsDataContext dc = new

    ProjectsDataContext(SPContext.Current.Web.Url);

 

    EntityList<EmployeesItem> Employees = 

    dc.GetList<EmployeesItem>("Employees");

 

    var empQuery = from emp in Employees

                   where emp.Project.DueDate <                    DateTime.Now.AddMonths(6)

                   select new { emp.Title, emp.JobTitle, 

                   ProjectTitle = emp.Project.Title, 

                   DueDate =                    emp.Project.DueDate.Value.ToShortDateString() };

 

    spGridView.DataSource = empQuery;

    spGridView.DataBind();

}

 

Task 4: Deploy and Test the WebPart

1. Right click on your project and select Deploy. 

2. Add the web part to a web part page:

Click the Edit button to put the page in edit mode. 

Click Insert

Click Web Part

Click Custom

Click SPLinqDemoPart Title

Click Add 

 

image

The rendered web part will look like this.

image

Exercise Summary

In this walkthrough you built and deployed a Visual Web Part that uses LINQ to SharePoint to gather data from a SharePoint list.

  

February 10th, 2010 Neal McFee No comments

SharePoint 2010: Professional Developer Evaluation Guide and Walkthroughs

This evaluation guide is designed to give you an overview of the feature set and extensibility points for Microsoft SharePoint 2010 and an understanding of how the professional developer can use these features and extensibility points to create comprehensive solutions. This guide begins with an overview of the types of solutions that you can build by developing on SharePoint. It then addresses the developer tools for SharePoint 2010, the new platform features, and the solution deployment enhancements. The guide concludes with six walkthroughs that show example developer customizations in SharePoint 2010.

Contents

 
  • Abstract
  • Introduction   
  • Summary of What’s New
  • Key Types of Solutions Built on SharePoint by Developers
  • Building Applications on SharePoint
  • Business Collaborative Applications
  • User Interface Portal for Line of Business Application Data
  • Customizing Out-of-Box Workloads
  • One Web Part Solutions
  • Improved Developer Productivity with Better Tools
  • Visual Studio 2010 SharePoint tools
  • Visual Studio 2010 SharePoint tools extensibility
  • Developer Workstation support for Windows 7 and Windows Vista SP1
  • Upgrading from Visual Studio 2008 extensions for SharePoint to Visual Studio 2010 SharePoint tools
  • SharePoint Designer 2010
  • SharePoint Designer 2010 Workflow Design
  • SharePoint Designer 2010 Business Connectivity Services Design
  • Developer Dashboard
  • SharePoint 2010 Application Lifecycle Management
  • Better Solutions with Rich Platform Services
  • User Interface
  • Building User Interface
  • The SharePoint 2010 Ribbon
  • The SharePoint 2010 Dialog Framework
  • New Silverlight Web Part
  • Data and Programmability
  • SharePoint List Lookups and Relationships
  • Business Connectivity Services
  • LINQ to SharePoint
  • Performance Enhancements
  • Event Enhancements
  • Workflow Enhancements
  • Document Sets
  • SharePoint 2010 API Choices
  • Flexible Deployment Increases the value of SharePoint Solutions
  • Sandboxed Solutions
  • SharePoint Online
  • Upgrading Solutions
  • Learning More
  • Conclusion
 
SharePoint 2010 Developer Walkthroughs
Walkthrough 1: Using LINQ to SharePoint from within a Visual web part
Walkthrough 2: Building a Web Part for a Sandboxed Solution
Walkthrough 3: SharePoint Designer Workflows imported to Visual Studio 2010
Walkthrough 4: Accessing List Data using the JavaScript Client OM
Walkthrough 5: Creating and Using External Lists in SharePoint 2010
Walkthrough 6: Extending the SharePoint 2010 UI with Silverlight

 

Link to PDF – SharePoint 2010: Professional Developer Evaluation Guide and Walkthroughs

February 10th, 2010 Neal McFee No comments

New Feature Receiver Method ~ SPFeatureReceiver.FeatureUpgrading

Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes

  Syntax

Visual Basic (Declaration)

Public Overridable Sub FeatureUpgrading ( _
    properties As SPFeatureReceiverProperties, _
    upgradeActionName As String, _
    parameters As IDictionary(Of String, String) _
)

Visual Basic (Usage)

Dim instance As SPFeatureReceiver
Dim properties As SPFeatureReceiverProperties
Dim upgradeActionName As String
Dim parameters As IDictionary(Of String, String)

instance.FeatureUpgrading(properties, _
    upgradeActionName, parameters)

C#

public virtual void FeatureUpgrading(
    SPFeatureReceiverProperties properties,
    string upgradeActionName,
    IDictionary<string, string> parameters
)
Parameters
properties
Type: Microsoft.SharePoint..::.SPFeatureReceiverProperties
upgradeActionName
Type: System..::.String
parameters
Type: System.Collections.Generic..::.IDictionary<(Of <(String, String>)>)

 

Link – MSDN original

February 8th, 2010 Neal McFee No comments