Tuesday, 16 October 2012

Creating your first SharePoint 2010 site


To create a Web application, you must be a member of the Administrators group on the farm and the local machine running the SharePoint 2010 Central Administration.

Creating the Web application


A Web application consists of a IIS (Internet Information Services) website

each may combine one or more site collections that you create. The first step is to create a Web application.

Open the SharePoint 2010 Central Administration:


In the Application Management section, click the Manage web applications link. The page lists the referenced web applications on the server. For a basic installation, you have two:
  • The default site: SharePoint - 80
  • The administration site: SharePoint Central Administration v4


Click theNew button in the toolbar to open the creation form:


Regulars of SharePoint 2007 will notice that this form has many similarities to the functional level. By cons, level design, opening in a layer shows a part of the efforts made by Microsoft to improve the ergonomics of the product.


Authentication


The authentication section offers a choice between two types of authentication:
  • Claims Based Authentication
  • Classic Mode Authentication
The default choice is Classic Mode Authentication, a classic Windows authentication. The authentication type Claims Based Authentication aims to make it simpler authentication through systems such as Active Directory and provide Sinsgle-Sign-On methods for applications based on shared environment or Cloud.
We will choose the default authentication type Classic Mode Authentication to our new web application.

IIS Web Site


This section allows you to specify the details of your new Web application as it will be in IIS.
You can use an existing IIS Web site or create a new completely dependent from others. Choose to create a new IIS Web site and name it the SandBox.
Change the value of Port field by 80.
Specify in the Host Header filed the value www.sandbox.priv.
You can leave the default value for the Path field: C:\inetpub\wwwroot\wss\VirtualDirectories\www.sandbox.priv80

Security Configuration


This section presents three options to configure.
The first is the authentication provider (Authentication provider), you can choose between values Negotiate (Kerberos) and NTLM. The latter is the default choice of the form. The choice of the authentication provider will depend on your infrastructure, in our case, a single server without Active Directory, we will use the NTLMprovider.
The second option allows you to enable or disable anonymous access on the site. If you choose to allow anonymous access, access will be using the machine specific anonymous access account IUSR. Site administrators can configure the use of anonymous access to their sites. If anonymous access is not permitted at the Web application, it will not be at the site. For this article, we choose No.
The third and final option is to specify whether SSL is used. If you want to enable SSL on your Web application, you must configure IIS more finely ( How to configure SSL on IIS7).

Public URL


In this section, enter the URL of the web application. It will be used as a base in the links on the pages in this zone of Web application. The default URL is the name and port of the current server, it's automatically updated according to the SSL settings, header host and port number defined on the form.
The value of the Zone field is automatically defined on Default. The zone can be changed when you extend a Web application.

Application Pool


Each Web application is represented by a different IIS Web site with a unique application pool or a shared one. This section lets you specify whether you want to use an existing application pool or create a new one. We choose to create a new application pool named SandBox.
When creating a new application pool, you must specify the user who executes it. This choice is important because this account must have permissions to access different parts of the server. You can create a specific user or select an existing one. We choose Predefined and the Network Service account.

Database Name and Authentication


When you create a Web application, you also create a database of content and set the authentication method used to connect to the database. This section allows you to choose the database server to use, by default, the SQL server which is running the administration is selected in the Database Server field.
The Database Name field is the name of the database to be created on the SQL server. By default, the name is a GUID prefixed by WSS_Content_. We will name it SandBox.
This section also lets you set the authentication method used for the Web application connects to SQL server. There are two options: Windows authentication (recommended) andSQL authentication. The Windows authentication method is recommended because the login information is sent encrypted to the SQL server. The account used will be the application pool. This implies that the user running the application pool for Web application can access to SQL server.

Failover Server


This section allows you to specify a mirror SQL server. In case of problem on the SQL server, queries are sent to the following. The authentication method and the account used for this mirror server will be the same settings as the principal server.

Search Server


This section allows you to specify the search server used. It's set to use the SharePoint Server search.

Service Application Connections


In this section, select the connections to the service application will be available for the Web application. From the dropdown menu, choose default or [custom]. The [custom] option lets you choose the connections to the service applications that you want to use for the Web application. The default is to make available all services.
We will choose the default option in this section.

Customer Experience Improvement Program


In this section, simply click Yes or No to specify whether you want to participate in the CEIP (Customer Experience Improvement Program) program.


The configuration is now complete, click OK to validate the creation of the Web application. When the creation process is completed, you receive a confirmation message:

You can go to IIS to see the new IIS Web site and on your SQL server to verify the creation of the new database:


 After creating a Web Application in SharePoint, the web site is actually not created yet. It means if you try to access the Web Application using the web app url, it will show you "Page cannot be displayed" error. Basically at this point of time, a web application has been created and all the mandatory configuration has been done. Now the next step is to create a Site Collection using a particular Site Definition, then only the actual site will be created and you will be able to access the site using the url of Site Collection.

Creating the site collection


To create a new site collection, you can either click on the Create Site Collection link in the message confirming the creation of a new Web application, or click the Create Site Collections link from the Application Management section on the homepage of the central administration.
The form for creating a site collection is very similar to SharePoint 2007:


Web Application


This section allows you to specify on whichWeb application the new site collection will be created. We choose the application you created earlier.

Title and Description


You can specify the title of the collection sites and give a description.

Web Site Address


This section allows you to specify the base folder of the site collection, it can be the root folder or the folder sites. There can be only one site collection to the root of a Web application, then others will be on the folder sites.

Template Selection


The site template defines the basic functionality will be enabled. This choice depends greatly on the type of project to be realized. We choose Publishing Portal under the tabPublishing. This is a site template including workflow features for publishing content.

Primary Site Collection Administrator


Here you must specify a user (you can not specify a group) as the administrator of the collection site. We choose the server administrator.

Secondary Site Collection Administrator


Comme l'option précédente, cette section permet de définir un second administrateur pour la collection de site. Ce champ est facultatif et nous le laisserons vide.
Like the previous option, this section allows administrator to define a second site collection administrator. This field is optional and we leave it empty.

Quota Template


This last section allows you to specify a quota for the site collection.


Click the OK button to begin creating the site collection.

After you have updated your DNS or Host file, you should be able to access the site via its URLhttp://www.sandbox.priv:

Template ID's in SharePoint 2010


Sr.no
Temple name
Temple ID
1
Custom List
100
2
Document Library
101
3
Survey
102
4
 Links Link
103
5
Announcements 
104
6
Contacts
105
7
Events 
106
8
Task List
107
9
Discussion Board 
108
10
Picture Library 
109












List Definitions

These List Definitions come from the SPListTemplateType enumeration.

Enumeration Name Description ID
InvalidType Not used -1
NoListTemplate unspecified list type 0
GenericList Custom list 100
DocumentLibrary Document library 101
Survey Survey 102
Links Links 103
Announcements Announcements 104
Contacts Contacts 105
Events Calendar 106
Tasks Tasks 107
DiscussionBoard Discussion board 108
PictureLibrary Picture library 109
DataSources Data sources for a site 110
WebTemplateCatalog Site template gallery 111
UserInformation User Information 112
WebPartCatalog Web Part gallery 113
ListTemplateCatalog List Template gallery 114
XMLForm XML Form library 115
MasterPageCatalog Master Page gallery 116
NoCodeWorkflows No Code Workflows 117
WorkflowProcess Custom Workflow Process 118
WebPageLibrary Wiki Page Library 119
CustomGrid Custom grid for a list 120
SolutionCatalog Solutions 121
NoCodePublic No Code Public Workflow 122
ThemeCatalog Themes 123
DataConnectionLibrary Data connection library for sharing information about external data connections 130
WorkflowHistory Workflow History 140
GanttTasks Project Tasks 150
Meetings Meeting Series (Meeting) 200
Agenda Agenda (Meeting) 201
MeetingUser Attendees (Meeting) 202
Decision Decisions (Meeting) 204
MeetingObjective Objectives (Meeting) 207
TextBox Text Box (Meeting) 210
ThingsToBring Things To Bring (Meeting) 211
HomePageLibrary Workspace Pages (Meeting) 212
Posts Posts (Blog) 301
Comments Comments (Blog) 302
Categories Categories (Blog) 303
Facility Facility 402
Whereabouts Whereabouts 403
CallTrack Call Track 404
Circulation Circulation 405
Timecard Timecard 420
Holidays Holidays 421
IMEDic IME (Input Method Editor) Dictionary 499
ExternalList External 600
IssueTracking Issue tracking 1100
AdminTasks Administrator Tasks 1200
HealthRules Health Rules 1220
HealthReports Health Reports 1221

Content Types

These content types come from the Content Type ID list.
Content Type ID
System 0x
Item 0×01
Document 0×0101
Event 0×0102
Issue 0×0103
Announcement 0×0104
Link 0×0105
Contact 0×0106
Message 0×0107
Task 0×0108
Workflow History 0×0109
Post 0×0110
Comment 0×0111
East Asia Contact 0×0116
Folder 0×0120

Sunday, 14 October 2012

create webpart custom properties in SharePoint 2010


Steps Involved(Webpart and not Visual webpart):

These custom properties will be displayed in the property pane as different controls according to the type of the property.
  • bool -> Check box
  • enum  -> Dropdown list
  • int -> Text box
  • string -> Text box
  • DateTime -> Text box


  • Open Visual Studio 2010.
  • Create an "Empty SharePoint Project".
  • Right click on the solution and click on Add => New Item.
  • Select "Webpart" template from SharePoint 2010 installed templates.
  • Entire solution looks like the following


     
  • Replace CustomProperties.cs file with the following code.
using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
namespace CustomProperties.CustomPropertiesWP
{
    [ToolboxItemAttribute(false)]
    public class CustomPropertiesWP : WebPart    {
           
private string _Name;
        private string _cmd;
        private int _Width = 0;
        public enum ControlModes
        {
            Simple,
            Standard,
            Advanced
        }
          Label lblResult;
          Button btnClick;

 /*Just represnt a label */

       [WebBrowsable(true), WebDisplayName("Name"), WebDescription("Enter Name"),
       Personalizable(PersonalizationScope.Shared), Category("Custom Properties"),
       System.ComponentModel.DefaultValue("Please Enter")]
  /*This actually represents the Field  - Textbox(String)*/
        public string Name
        {
            get { return _Name; }
            set { _Name = value; }

        }

                               //Another way of adding controls to Properties pane
       [System.Web.UI.WebControls.WebParts.WebBrowsable(true),
        System.Web.UI.WebControls.WebParts.WebDisplayName("Enter Comment"),
        System.Web.UI.WebControls.WebParts.WebDescription("Comment"),
        System.Web.UI.WebControls.WebParts.Personalizable(
        System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared),
        System.ComponentModel.Category("Custom Properties"),
        System.ComponentModel.DefaultValue("")]
        public string Cmd
        {
            get { return _cmd; }
            set { _cmd = value; }
        }
                
        [Personalizable(PersonalizationScope.User),WebBrowsable(true),
       WebDisplayName("Set Width"),WebDescription("Set width"),Category("Custom Properties")]
 /*This actually represents the Field  - Textbox (Integer)*/
        public int setWidth
        {
            get{return _Width;} 
            set{_Width = value;}
        }
       
        protected override void CreateChildControls()
        {
            lblResult = new Label();
            btnClick = new Button();
            btnClick.Text = "Click";
            btnClick.Click += new EventHandler(btnClick_Click);
            this.Controls.Add(lblResult);
            this.Controls.Add(btnClick);
        }
        protected void btnClick_Click(object sender, EventArgs e)
        {
           
lblResult.Text = "Welcome" + " " + _Name.ToString() + "<br /> Your Valuable Comment: " + Cmd.ToString()+"<br/>You have set the width as :"+setWidth+"<br/><br/>";
            if(setWidth!=0)
            btnClick.Width = setWidth;
            else
            btnClick.Width = 500;
        }       
        }       
    }
}
  • Build and deploy the solution.

  • Go to the SharePoint Site =>Site Actions =>Edit Page =>Editing Tools => Insert =>Web Part =>Categories => Custom =>CustomPropertiesWP.

     
  • Click on Add.
  • The web part looks like the following with a button.

     
  • Edit the webpart you could see a new custom category in the webpart properties.
  • Enter the value and click on Ok.

     
  • In the CustomPropertiesWP click on the button.

Managing SharePoint Designer 2010


SharePoint Designer 2010 is a powerful application used to build custom sites and solutions on the SharePoint platform. It’s a great way to create and customize pages, views, forms, data sources, workflows, and more.
But there are some tasks in SharePoint Designer that give SharePoint administrators real heartburn because of the potential problems it creates for them.
Here are the big 3:
  1. Detaching pages from their site definition – When you do this, intentionally or not, the page overrides the site definition and therefore won’t be recognized the next time the site definition is updated. This means you’ll be talking to your SharePoint administrator the next time the server is upgraded.
  2. Customize master pages and page layouts – While this may improve the look and feel of your site, there’s a risk that you’ll remove the corporate brand that was intended for all sites in your organization. Even worse, you could potentially break your site and other sites if you change or delete a required content region.
  3. Editing files directly in the site URL structure – This might be a quick and easy way to modify any file on your site, but in doing so, you could mistakenly delete a support file or template file required by SharePoint.
So on one hand, SharePoint Designer 2010 gives you a lot of power and flexibility in how you change the appearance or functionality of a SharePoint site. But on the other, if it’s used incorrectly, it can create issues for you, your site, and of course, your administrator.

The SharePoint Designer Settings page
In SharePoint 2010, you and your administrator will be happy to learn about the SharePoint Designer Settings page, which looks like this.


The SharePoint Designer Settings page helps you manage how SharePoint Designer 2010 is used in your organization by giving you control of these settings:
  1. Enable SharePoint Designer: Enables or disables SharePoint Designer for an entire application or site collection. When checked, SharePoint Designer can open and edit SharePoint sites. When unchecked, it cannot be used to open or edit sites.
  2. Enable Detaching Pages from the Site Definition: Enables or disables the ability to detach pages from the site definition. When checked, SharePoint Designer allows users to edit pages in Advanced Mode, giving them access to every part of the page and consequently when they save, the page is detached from its site definition. When unchecked, SharePoint Designer disables the Advanced Mode, forcing users to edit only the parts of the page in a Web Part Zone. The page, as a result, is never detached from the site definition.
  3. Enable Customizing Master Pages and Layout Pages – Enables or disables master pages and page layouts in SharePoint Designer. When checked, SharePoint Designer displays master pages and page layouts in the Navigation pane. When unchecked, these pages don’t appear in the Navigation pane of SharePoint Designer.
  4. Enable Managing of the Web Site URL Structure – Enables or disables the site URL structure and its contents. When checked, SharePoint Designer displays the All Files options in the Navigation pane allowing users to view and edit any file on the site. When unchecked, the All Files option doesn’t appear in the Navigation pane.
In Central Admin and Site Collection Admin
There are not one but two SharePoint Designer Settings pages that you can use to manage how SharePoint Designer 2010 is used in your organization:
  • Central Administration – The SharePoint Designer Settings page in Central Administration applies the settings at the web application-level for all site collection administrators on down. That’d be everyone.
  • Site Collection Administration – The SharePoint Designer Settings page in Site Collection Administration (you know, the Site Settings page for your top-level site) applies the settings at the site collection level to all designers and owners.
Use one or both pages to manage how SharePoint Designer 2010 is used in your organization without fear of it detaching pages, removing corporate brands, or breaking sites. You may even choose to temporarily enable and disable certain SharePoint Designer features depending on where you’re at with your SharePoint deployment.

Friday, 12 October 2012

Deploying WSP using Powershell


What is a Solution Package?

A solution is a deployable, reusable package that can contain a set of Features, site definitions, and assemblies that apply to sites, and that you can enable or disable individually. You can use the solution file to deploy the contents of a Web Part package, including assemblies, class resources, .dwp files, and other package components. A solution file has a .wsp file extension.
How to add the solution to the sharepoint farm and then deploy it to a particular web application is discussed below.

1. Adding solution package to the server

stsadm.exe -o addsolution -filename myEventCalendarList.wsp
OR
Use the complete location of the file, for example:
stsadm.exe -o addsolution -filename “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN\Solution\myEventCalendarList.wsp”

Deploy solution package command

2. Deploying the Solution

Deploy the solution using the following command:
stsadm -o deploysolution -name myEventCalendarList.wsp  -url http://sp-dev/ -local  -force
Here( -url) means the web application where to deploy the solution.
OR
Goto, Central Administration > System Settings >Manage farm solutions
Now click your solution from the list (for example, myEventCalendarList.wsp).

Manage farm solutions
a)  Now click Deploy Solution and select the web application where you want to deploy the solution (example, http://sp-dev here), Click OK when you are done.

Click Deploy Solution

Select web application where you want to deploy
b)  And finally you will have your solution deployed status like the following.

solution deployment status
You are done with deployment.

OPTIONAL STEP (You can do it when necessary):

Now you have to enable this feature at the website to use it. To do it follow these steps:
3.  Enable the features at the website>>
Go to your Site settings> Site Collection Administration > Site collection features
And activate the feature (myEventCalendarList ,for example)  that you have installed. And add that webpart  to your site to test.
Hope it helps.