Site Collection Operations in SharePoint 2013

Site Collection Operations in SharePoint 2013
           SharePoint 2013  Site Collection Operation is much easier using SPSite Powershell Cmdlet. Here we can see few new parameters in SharePoint 2013 SPSite.

  • Url and OwnerAlias
  • HostHeaderWebApplication
  • DestinationDatabase

New-SPSite


    The New SPSite cmdlet creates a new site collection with "URL and OwnerAlias" parameters.  specify This cmdlet can create site collections in either the SharePoint Server 2010 mode which uses the legacy 2010 versions of templates and features, or can be created in SharePoint Server 2013 mode which uses the new versions of templates and features.

Example:
            New-SPSite http://<sitename>/sitees/newsite  -OwnerAlias "Domain\AdminName" -Language 1033 -Template 'STS#0'

Move-SPSite

                           Move-SPSite cmdlet moves the data in the specified site collection from its current content database to the content database specified by the "DestinationDatabase" parameter. A no-access lock is applied to the site collection to prevent users from altering data within the site collection while the move is taking place. Once the move is complete, the site collection is returned to its original lock state. The destination content database specified must already exist, must be attached to the same SQL Server as the site collection's current content database, and must be attached to the site collection's current Web application.

   After run the Move-SPSite cmdlet ,run the IISRESET command to update changes to IIS.

Example:

               Move-SPSite http://servername/sites/sitename  -DestinationDatabase ContentDb6

  It moves the site collection http://servername -DestinationDatabase ContentDb6

Host-name site Collection 

             It allows to create a Host-name Site Collections adding ,using the "HostHeaderWebApplication" ParameterIt idetifies the Web Application where the site collection is being Created.

Example:

         New-SPSite SiteCollectionURL -HostHeaderWebApplication 'WebAppURL' -Name 'TopLevelSite' -Description 'Top Level Site Collection' -OwnerAlias 'Domain\administrator' -language 1033 -Template 'STS#0'

how to populate values in dropdownlist from database using asp.net

In this article we can able to see  how to Populate values in to drop down from Data Base using asp.net

 public void loadDdlRoles()
        {

            string constr = ConfigurationManager.ConnectionStrings["DConnectionString"].ToString(); // connection string
            SqlConnection con = new SqlConnection(constr);
            con.Open();

            SqlCommand com = new SqlCommand("select *from dbo.aspnet_Roles", con); // table name 
            SqlDataAdapter da = new SqlDataAdapter(com);
            DataSet ds = new DataSet();
            da.Fill(ds);  // fill dataset
            DdlRoles.DataValueField = ds.Tables[0].Columns["RoleName"].ToString();             // to retrive specific  textfield name 
            DdlRoles.DataSource = ds.Tables[0];      //assigning datasource to the dropdownlist
            DdlRoles.DataBind();  //binding dropdownlist


        }
Don't Forget to call that method in Page load

 protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                loadDdlRoles();
          }

        }
Keep always Smile:)

Display Data in Grid View

Hi Friends
In this article i will explain how to display data in grid view.
Step 1:
We created a database dotnetdb and with  table name Employee.

USE [dotnetdb]
GO

/****** Object:  Table [dbo].[Employee]    Script Date: 01/03/2015 15:25:10 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Employee](
[EmpId] [nvarchar](50) NOT NULL,
[EmpName] [nvarchar](50) NOT NULL,
[EmpAddress] [nvarchar](50) NOT NULL,
[EmpDesignation] [nvarchar](50) NULL
) ON [PRIMARY]

GO

Step 2:

We created a empty web application with name GridView and selected a WebForm and renamed with name  Displaydata.aspx.

UI Screen


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Displaydata.aspx.cs" Inherits="GridView.Displaydata" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
     <asp:GridView ID="GridView1" runat="server">
    </asp:GridView>
    </div>
   
    </form>
</body>
</html>
Step:3

Businesslogic.

In Displaydata.aspx.cs write the business logic.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

namespace GridView
{
    public partial class Displaydata : System.Web.UI.Page
    {
        SqlConnection con = new SqlConnection("Data Source = Chinnu;Initial Catalog = dotnetdb;uid = sa;password = password123;");
        protected void Page_Load(object sender, EventArgs e)
        {
            dataBindGrid();
        }

        public void dataBindGrid()
        { 
            SqlDataAdapter da = new SqlDataAdapter("select * from Employee",con);
            DataSet ds = new DataSet();
            da.Fill(ds); 
            GridView1.DataSource = ds;
            GridView1.DataBind(); 
        }
    }
}

Output:Finally Press F5 we can able to see the Output.







    
  


How to create Lookup Field List using Power shell Script in SharePoint 2013

How to create Lookup Field List using Power shell Script in SharePoint 2013
Continution to Previous post  , here we are going to see how to create lookup field from Power Shell  in SharePoint 2013

 Create a SharePoint Custom List Department with Lookup Column

SNAME    -  Lookup
SID -Number

#List type or template
$spTemplate = $spWeb.ListTemplates["Custom List"]

#Get all the lists to the listcollection
$spListCollection=$spWeb.Lists

#adding the new list to the list collection
$spListCollection.Add("Department","Department",$spTemplate)

#get the path of subsite and sitecollecion
$path = $spWeb.url.trim()

#get the list to the list object
$spList = $spWeb.GetList("$path/Lists/Department")

#adding the field type(Lookup) to the list
$LookupList= $spWeb.Lists["Student"]
$fieldXml='<Field Type="Lookup" DisplayName="SName" ShowField="SName" StaticName="SName" List="' + $LookupList.id + '" Name="SName"></Field>'
$spList.Fields.AddFieldAsXml($fieldXml,$true,[Microsoft.SharePoint.SPAddFieldOptions]::AddFieldToDefaultView)

#adding the field type(Number) to the list
$spFieldType = [Microsoft.SharePoint.SPFieldType]::Number
$spList.Fields.Add("SID",$spFieldType,$false)

$Views = $spList.Views["All Items"]
$Views.ViewFields.Add("SID")
$Views.Update()

How to create List using Power shell Script in SharePoint 2013

How to create List using Power shell Script in SharePoint 2013
In this post we are going to see how to create Custom List from Power Shell in SharePoint 2013.
How to add fields to list in sharepoint using powershell - See more at: http://www.dotnetsharepoint.com/#sthash.vM7z4E6E.dpuf
How to add fields to list in sharepoint using powershell
Copy value from one filed to another field using PowerShell
Add X years to date column based on item created date in SharePoint PowerShell
How to import users from CSV to SharePoint site using PowerShell
How to update the modified by using power shell
How to add column in to List using Power Shell
Date formula in SharePoint calculated value

Create a SharePoint Custom List  Student Info with Columns
SNo    -  Number
SName  -  Text
Gender -  Choice
Photo  -  URL

#To which site u want to create the list
$spWeb=Get-SPWeb -Identity http://c4968397007

#List type or template
$spTemplate = $spWeb.ListTemplates["Custom List"]

#Get all the lists to the listcollection
$spListCollection=$spWeb.Lists

#adding the new list to the list collection
$spListCollection.Add("Studentlist","Studentlist",$spTemplate)

#get the path of subsite and sitecollecion
$path = $spWeb.url.trim()

#get the list to the list object
$spList = $spWeb.GetList("$path/Lists/Studentlist")

#adding the field type(Number) to the list
$spFieldType = [Microsoft.SharePoint.SPFieldType]::Number
$spList.Fields.Add("SNo",$spFieldType,$false)

#adding the field type(Text) to the list
$spFieldType = [Microsoft.SharePoint.SPFieldType]::Text
$spList.Fields.Add("SName",$spFieldType,$false)

#adding the field type(choice) to the list
$choices = New-Object System.Collections.Specialized.StringCollection
$choices.Add("Female")
$choices.Add("Male")
$spFieldType = [Microsoft.SharePoint.SPFieldType]::Choice
$spList.Fields.Add("Gender",$spFieldType,$false,$false,$choices)

#adding the field type(url) to the list
$spList.Fields.Add("Photo","URL",$false)

$Views = $spList.Views["All Items"]
$Views.ViewFields.Add("SNo")
$Views.ViewFields.Add("SName")
$Views.ViewFields.Add("Gender")
$Views.ViewFields.Add("Photo")

$Views.Update()

Managed meta data navigation in sharepoint 2013

We can manage navigation of site collection using Meta data in SharePoint 2013. Managed Meta data navigation and friendly URL is a new feature in SharePoint 2013. We can have the term store to create and store the navigation. We have to create managed Meta data service. To enable Meta data navigation, activate publishing feature at site collection level.


Go to site settings, in the “Look and Feel” section, select “Navigation”



Select Managed navigation for top navigation as shown in the image below,



In the term store management (In Site settings, Site Administration group, select “Term store Management”)

Create term in Site Collection navigation as shown in the image below.



By adding the terms in term store tool, we can see the tabbed view as in the image below. In “GENERAL” tab, we can see the general properties of the term like Name, Available for tagging...



“NAVIGATION” section allows us to create friendly URL’s for the navigation. If we select, “term-Driven Page with Friendly URL”, it will choose the default URL. By selecting “Simple Link or Header”, we can assign the custom link to the navigation.



In “TERM-DRIVEN PAGES”, tab, we can have the option to configure the friendly URL and allows to set an image.




“CUSTOM PROPERTIES” tab allows us to add “Shared Properties” and “Local Properties”.



Create the navigation as the structure shown below.




After saving the navigation, we can see it as the image below.







SharePoint 2013 PerformancePoint Services Configuration

Configuring PerformancePoint Services (PPS) 

   For configuring PPS, one should complete the following three steps to use PerformancePoint features. The three important steps are:
  • Start a Secure Store Service and Performance Point Service at farm level via Central Admin. 
  • Configure the Secure Store Service. 
  • Configure the PPS application. 
1 .Start Secure Store Service and Performance Point Service

To start configuration of the Secure Store Service and PerformancePoint Service, we have to start on the Farm. For that go to CA -> Application Management -> Service Application ->  Manage Service on server.
Here on this page there are many services available. Out of these services, start Performance Point Service and Secure Store Service as shown below:
This will allow configuring further steps. 

2. Configure the Secure Store Service 

  The Secure Store Service is an authorization service that runs on an application server. It provides a database that is used to store credentials. These credentials usually consists of username and passwords but can also contain some other fields. Then these credentials can be used to connect external systems like PerformancePoint Services, BCS, Excel Services, Visio Services etc.. 

     The first time you access the Secure Stored Services it will ask you generate a new encryption key. This key will be used to encrypt and decrypt credentials stored in Secure store.


To configure the Secure Store Service, enter Central Admin -> Application Management -> Manage service applications.










Here on this page there are many services application available. Out of these services application, select Secure Store Service as shown below:













Once the Secure Store page open then there is no key generated which would encrypt the credentials. To create a new key, click on “Generate new key” on the top ribbon.










A pass phrase needs to be created to encrypt the key. Accept the check to Re-encrypt the Database Using the New Key and click OK.
















3 Configuring the PPS application

       The PerformancePoint Service is a SharePoint Server 2013 service application. It enables users to create business intelligence(BI) dashboards that provide insight into an organization’s performance. It help you create scorecards, and key performance indicators(KPIs) in web browsers, that can aggregate their content from multiple sources and help companies make important decisions.

    Once the Secure Store service is configured then to configure the PerformancePoint service application, re-enter CA -> Application Management -> Manage service applications.




Here on this page there are many services application available. Out of these services application, select PerformancePoint service application as shown below:




There will be several options such as defining the trusted data source location or content locations, importing PPS content and others. For our purpose, click on "PerformancePoint Service Application Settings".





By default the Secure Store Service name will be pre-populated. In order to configure the unattended account, provide an appropriate username and password and click OK.






facing issues while Configuration PerformancePoint Services we can check below.