IT tutorials
 
Technology
 

The SharePoint 2010 Feature Solution Framework : Writing Your First SharePoint Console App

9/22/2013 7:32:14 PM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

Writing a SharePoint console app is quite simple.

  1. On your SharePoint development machine, create a new Console Application in Visual Studio 2010. As shown in Figure 1, make sure your target framework is .NET 3.5. This is because SharePoint 2010 is built on .NET 3.5 SP1.

    Figure 3. Target Framework set to .NET 3.5
  2. Add a reference to Microsoft.SharePoint.dll. You will find this reference under the .NET tab of the Add References Dialog within Visual Studio. Look for Microsoft.SharePoint.

  3. Right-click your project and choose properties. Under the Build section, change the platform of your console application to AnyCPU or x64. The default in Visual Studio 2010 is x86, because it is envisioned that for a very long time to come x86 apps will be the default application of choice unless an application needs to deal with massive amounts of data. x64 apps require too much segment calculation for them to be efficient in most scenarios. On the other hand, AnyCPU apps have an initial starting overhead, but once they are started, they run quite well. (I prefer to go with AnyCPU in most instances.)

  4. Finally, write some code in your static void main, as shown in the following:

    using (SPSite site = new SPSite("http://sp2010"))
    {
    Console.WriteLine(site.RootWeb.Title);
    }

    Remember to add a using statement for Microsoft.SharePoint.

That's basically it. Hit F5 to run your application and now you should be able to view the title of the Site at http://sp2010. There is plenty else to learn in the SharePoint object model. Luckily, most of it is named well so it is easy to figure out what most of it does. You will see many classes, but for now please go ahead and familiarize yourself with the following basic classes in the SharePoint object model:

  • SPFarm

  • SPWebApplication

  • SPSite

  • SPWeb

  • SPList

  • SPListItem

  • SPDocumentLibrary

There are many more objects to be familiar with and throughout this book as well as while working with SharePoint you will learn them as you go.

As I said earlier, you will never deploy new functionality to production using console applications. Also, when you write new functionality for SharePoint 2010, the only good and maintainable way to deploy such functionality is as a SharePoint solution. A solution is simply a .cab file, renamed to a .wsp file. If you were to simply rename a .wsp file to a .cab file and open it, you will most definitely see a manifest.xml file in there. The manifest.xml file is what SharePoint would use to understand what the solution contains.

What can any solution contain? A solution can contain plain artifacts being deployed to the file system, content database, or any new executable artifacts such as web pages, server controls, or WebParts. So, what does it take to write a simple feature or solution that deploys a new WebPart? Before I describe how to write a WebPart, first let's define WebParts.
 
Others
 
- Windows Server 2012 : Resource Records (part 2) - Service Records
- Windows Server 2012 : Resource Records (part 1) - Start of Authority Records, Host Records, Name Server Records
- Windows Server 2012 : Installing DNS Using the Add Roles Wizard
- Windows Server 2012 : The Need for DNS - Explaining the DNS Hierarchy
- Sharepoint 2013 : Claims-based authentication, federated identities, and OAuth (part 7) - Understanding OAuth, Configuring server-to-server apps
- Sharepoint 2013 : Claims-based authentication, federated identities, and OAuth (part 6) - Federating with Windows Azure ACS
- Sharepoint 2013 : Claims-based authentication, federated identities, and OAuth (part 5) - SharePoint trusted IPs - Creating a custom claims provider
- Sharepoint 2013 : Claims-based authentication, federated identities, and OAuth (part 4) - SharePoint trusted IPs - Configuring the target web application
- Sharepoint 2013 : Claims-based authentication, federated identities, and OAuth (part 3) - Building a relying party
- Sharepoint 2013 : Claims-based authentication, federated identities, and OAuth (part 2) - Building an STS
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us