Installing SharePoint 2013 Step by Step–Part 1


Software’s Used

Windows Server 2012 Trial

SQL Server 2012 With SP1 Trial

SharePoint 2013 Trial

Microsoft Office 2013 Trial

SharePoint Designer 2013

Visio 2013

Project Server 2013

Visual Studio 2012 Trial

I hope you know how to Install Windows Server 2012 on a HyperV, VMware or any other cloud hosting sites like skytap or cloudshare.

image

image

image

image

image

image

image

image

image

image

Restart the server.

image

image

image

image

image

image

image

image

image

image

image

image

image

image

image

image

image

Installing SharePoint 2013

image

image

image

image

image

Automatic Restart on Finish.

image

image

.image

image

image

When Setup Finishes.  Uncheck the Run the Product Configuration Wizard and Click Finish.

Let’s Install SQL Server.

I have downloaded SQL Server 2012 Enterprise with SP1

5:12 PM

clip_image001

image

image

image

image

image

image

image

image

image

image

image

Created a Folder in C Drive SQL Server with three subfolders 1 for Analysis Services, 1 for DB and 1 for Log Files.

image

image

image

image

image

image

image

Not Necessary.

image

image

image

image

image

image

image

image

image

image

Take a Coffee Break (Highly Recommended)

Now Let’s Create Users

Although we can create as many as 7 account but remember I am setting up a Test VM so we will create 3.

SP_Farm, SP_Content and SP_Services

image

image

image

image

image

image

image

click Next and Finish.

image

image

Repeat the same step for SP_Content

image

The other accounts that you can create for Multi Server Farm are

SP_Search, SP_UserProfile, and any other account that need for Service Apps like Excel, PerformancePoint.

image

Now go to apps and Open SQL Server Configuration Manager to check TCP IP Protocol is enabled or not.

image

image

Also Check the Required Services are running.  Stop and Set to manual the services that you do not need.

image

Let’s Test the login to SQL Server

image

image

Let’s Run the SharePoint 2013 Products Configuration Wizard.

image

image

Click Next

image

Click Yes

clip_image001[1]

Enter Your SQL Server Name in Single Server it can be your machine Name.  If you have installed Named instance you have to enter Machine\InstanceName

Enter SharePoint Farm Admin User.  This user should not have any access to SharePoint.  In my case I am using Administrator.  You can use SP_Farm Account here. 

You can change the Farm Account after installation of SharePoint from Central Admin.

image

Enter passphrase

image

Enter Central Admin Port

image

Review Changes

image

clip_image001[3]

image

Click Finish to Start Central Administration for the firs time.

image

image

image

image

image

image

I clicked Cancel as I do not want to create all the service applications using the Wizard.  I will create them one by one.

Now Install Visual Studio 2012

image

image

image

image

image

Now also Install the First Visual Studio 2012 Update from here

http://www.microsoft.com/visualstudio/eng/visual-studio-update

Let’s Create some Sample Users in Active Directory

First download the script from my sky drive

Copy it to C Drive

Coupe of things to make sure.  Open the AddUsersToAd.vbs file and Find and Replace contoso with your domain name and com with your e.g. LOC or edu etc.

clip_image001[5]

image

Install Office Professional Plus 2013

image

Install SharePoint Designer 2013

image

Lets Install the Workflow Manager and its tools for Visual Studio 2012

image

image

Choose Configure Workflow Manager with Custom Settings.  You can also choose first option if you don’t want to look what’s in there.

image

image

image

Make sure you enter the user name as fully Qualified Name e.g. administrator@contoso.com

image

Enter Key for Certificates

image

Choose “Allow Workflow Management over http

clip_image001[7]

Click Next

image

image

Check the box to use same certificate for bus.

image

image

Review

image

image

image

Attaching Workflow Server to site require a small Management Shell Script.

Register-SPWorkflowService –SPSite "<SITEURL>" –WorkflowHostUri "ServerName">ServerName">http://>ServerName>:12291" –AllowOAuthHttp

Let’s Install SharePoint Developer Tools for Visual Studio 2012 Preview 2

Search for SharePoint

image

Add SharePoint Developer Tools for Visual Studio 2012 Preview 2

image

image

image

image

image

Let’s Disable Loop Back Check

image

End of Part 1

Next Parts

  • Configuring SharePoint 2013 for App Development
  • Configuring Service Applications
  • Configuring User Profile Service Application
  • Configuring Search

SharePoint 2013 CSOM and REST Improvements


I still remember back in the time of SharePoint 2007 and before the only way to create Applications for SharePoint was either use the Server Side Object Model or SOAP based web services.  Server side object mode was great but not having the ability to run out of SharePoint Server made is limited for SharePoint web parts and custom console application only.  Web services were there but they were not enough for everything that we need and as everything was XML it was sometimes very difficult to control and extend.  I still remember that I was part of the team that developed a project that uses SharePoint Lists Web Services to get and set data from Biztalk and Project Server and I have to build classes to build CAML and ViewFields.

SharePoint 2010 came up of couple of great ways to extend application development possibilities.  The Client Object Model and REST based listdata.svc made it possible to develop remote applications for SharePoint. 

There are three flavors of Client OM in SharePoint 2010.

  • .NET Managed Client OM
  • Silverlight Managed Client OM
  • JavaScript Client OM

It is important to know that the backbone of SharePoint Client OM was client.svc.  The service which was commonly reffered as WCF Entry point was response for executing the code that you write using the proxy writing using either of the above flavors.  The code is passed to client.svc as XMLhttpRequest execution happens as Batch.  client.svc handles the serilization and parsing of replies.  Once finished processing the response is send as JSON.

Managed Client OM.

NET Client Object Model and Silverlight Client OM were almost same in the implementation and to use .NET Client OM from either a Windows or Console application you have to add references to two Microsoft.SharePoint.Client and Microsoft.SharePoint.Client.Runtime and then write the proxy code which will later executed by client.svc.  Remember that code is Client OM can execute Synchronously.

You call ClientContext.ExecuQuery() method.

Silverlight Client OM

The difference with Silverlight was the difference of DLLs. The SharePoint Root Folder Client Bin folder had two Silverlight Client Dlls that you have to add to your Silverlight Class library.  The implementation is almost same other than the fact calls to SharePoint from Silverlight must be done using asynchronously callback. 

You call ClientContext.ExecuQueryAsync(SucessDelegate, FailureDelegate); method.

JavaScript Client OM.

The third and final way of writing client side applications for SharePoint is/was JavaScript OM.  JavaScript Client OM uses SP.JS, SP.Core.JS files which contains the proxy implementation calls to client.svc.  The pattern or writing the app was same but there was difference between Windows/Silverlight and JavaScript by JavaScript using methods instead of properties and method name used in JavaScript were not same.  JS Client OM works perfectly with jQuery, JSRender and other libraries and provide support for Atom & oData standards.

By far JavaScript client OM was the most difficult way of writing SharePoint applications. Reason was Visual Studio providing strongly typed object, type checking and debug support for SharePoint objects while for debugging in JS OM we have to live with debugging in IE Developer tools only.  The place where I was during the 2010 implementation time frame I saw few people developing anything in JavaScript. 

One of the major drawbacks of Client Object Model in SharePoint was limited access to SharePoint functionality. 

image

Client Object Model Changes in SharePoint 2013

Although the overall architecture of Client OM in SharePoint 2013 remains the same but there are some major improvement.  The biggest improvement is that the all time hidden Client.svc is directly available for developers to make REST calls to do Get and POST Requests.  Client.svc implements the core features of OData specifications.  For more information please visit www.odata.org or http://msdn.microsoft.com/en-us/library/fp142385.aspx.  Please note that you can continue to use the 3 traditional methods to reach SharePoint Data.

SharePoint 2013 Client OM Extends reach to SharePoint Data by providing access to

  • User Profiles
  • Search
  • Social Feeds
  • Sharing
  • BCS
  • IRM
  • Analytics
  • E-Discoverry
  • Publishing
  • Workflow
  • Taxonomy
  • List Data

image

For Developing Managed and Silverlight

Based application using CSOM new set of assemblies have been added to SharePoint Root Bin Folder that you can access to use as proxy to write Client side code.  The methods in these assemblies use the same syntax that was used by 2010 Client OM Implement using ClientContext.  Now using Client OM you can add pages to a publishing site as well as traverse a Term Set and get or set status of your workflow. 

image

Let’s Create Couple of Examples.  There are so many possibilities when it comes to the new client OM.  So I just created small application to test some of the functionality.

image

Let’s check some basic SharePoint List Code.  In this Managed Client OM code I am connecting to my Web and adding a custom list then adding a Field using XML and then iterating to all the lists to display a message box. 

using(ClientContext context = new ClientContext(new Uri("http://intranet.contoso.com")))
{
Web RootWeb = context.Web;

ListCreationInformation newList = new ListCreationInformation();
newList.Title = "CSOM Custom List";
newList.Url = "Lists/CsomCustomList";
newList.QuickLaunchOption = QuickLaunchOptions.On;
newList.TemplateType = (int)ListTemplateType.GenericList;
List NewCustomList = RootWeb.Lists.Add(newList);


context.Load(NewCustomList);

string FieldAsXML = "<Field Name='ClientOMField' DisplayName='CustomField' Type='Text' Hidden='False' Description='Client OM Field' />";
Field fld = NewCustomList.Fields.AddFieldAsXml(FieldAsXML, true, AddFieldOptions.DefaultValue);

ListCollection allLists = RootWeb.Lists;
context.Load(allLists);

context.ExecuteQuery();
MessageBox.Show("List Created Successfully");
string strlist = "";
foreach(List aList in allLists)
{
strlist += aList.Title.ToString() + Environment.NewLine;
}

MessageBox.Show(strlist);

}

Now the below code will add a new item in this list.

using (ClientContext context = new ClientContext(new Uri("http://intranet.contoso.com")))
{
Web RootWeb = context.Web;

ListItemCreationInformation NewListItme = new ListItemCreationInformation();
List MyList = RootWeb.Lists.GetByTitle("CSOM Custom List");
ListItem MyItem = MyList.AddItem(NewListItme);
if (textBox1.Text.Length == 0)
{
MessageBox.Show("Please enter Title in Text Box to Save.");
return;
}

MyItem["Title"] = textBox1.Text;
MyItem["CustomField"] = textBox1.Text;
MyItem.Update();

context.Load(MyItem);
context.ExecuteQuery();
MessageBox.Show("Item Created Successfully with ID :" + MyItem.Id.ToString());
}

Here is an example of reading User Profile using CSOM.

using (ClientContext context = new ClientContext(new Uri("http://intranet.contoso.com")))
{
Microsoft.SharePoint.Client.UserProfiles.ProfileLoader loader = ProfileLoader.GetProfileLoader(context);

context.Load(loader);

UserProfile profile = loader.GetUserProfile();
context.Load(profile);
context.Load(profile.PersonalSite);
context.ExecuteQuery();

MessageBox.Show(profile.PersonalSite.Url);

}
Another Example of using Search Client OM.
using (ClientContext context = new ClientContext(new Uri("http://intranet.contoso.com/sites/Search/")))

   {

       context.Credentials = System.Net.CredentialCache.DefaultCredentials;

       KeywordQuery keywordQuery = new KeywordQuery(context);

       if (textBox1.Text.Length == 0)

       {

           MessageBox.Show("Please enter Title in Text Box to Save.");

           return;

       }

       keywordQuery.QueryText = textBox1.Text;

 

       SearchExecutor searchExec = new SearchExecutor(context);

       ClientResult<ResultTableCollection> Results = searchExec.ExecuteQuery(keywordQuery);

       context.ExecuteQuery();

 

       if (Results != null)

       {

           if (Results.Value[0].RowCount > 0)

           {

               DataTable dt = new DataTable();

 

               dt.Columns.Add("Title");

               dt.Columns.Add("Path");

               dt.Columns.Add("Write");

               dt.Columns.Add("Author");

               dt.Columns.Add("Rank");

 

               foreach (var Row in Results.Value[0].ResultRows)

               {

                   DataRow dr = dt.Rows.Add();

                   if (Row["Title"] != null)

                   {

                       dr[0] = Row["Title"].ToString();

                   }

                   else

                       dr[0] = Row["AccountName"].ToString();

 

                   dr[1] = Row["Path"].ToString();

                   dr[2] = Row["Write"].ToString();

                   dr[3] = Row["Author"].ToString();

                   dr[4] = Row["Rank"].ToString();

               }

 

 

               dataGridView1.DataSource = dt.DefaultView;

           }

           else

           {

               MessageBox.Show("No Results Found for your Query " + textBox1.Text);

           }

       }

       else

       {

           MessageBox.Show("No Results Found for your Query " + textBox1.Text);

       }

       

   }

Here is an example of adding Page to a Publishing Site using the Publishing Client OM.

 
if (textBox1.Text.Length == 0)

{

MessageBox.Show("Please Enter Page Title...");

this.textBox1.Focus();

return;

}

using (ClientContext context = new ClientContext(new Uri("http://intranet.contoso.com/sites/Pub")))

{

Web webSite = context.Web;

context.Load(webSite);

 

PublishingWeb web = PublishingWeb.GetPublishingWeb(context, webSite);

context.Load(web);

if (web != null)

{

    List PublishingLayouts = context.Site.RootWeb.Lists.GetByTitle("Master Page Gallery");

    ListItemCollection allItems = PublishingLayouts.GetItems(CamlQuery.CreateAllItemsQuery());

    ListItem Layout = allItems.GetById(35);

    context.Load(Layout);

 

    PublishingPageInformation PubPageInfo = new PublishingPageInformation();

    PubPageInfo.Name = textBox1.Text + DateTime.Now.Date.Hour + DateTime.Now.Date.Minute + ".aspx";

    PubPageInfo.PageLayoutListItem = Layout;

 

    PublishingPage page = web.AddPublishingPage(PubPageInfo);

    context.Load(page);

    context.ExecuteQuery();

    

    MessageBox.Show("Success....: ");

 

}

}

Now the same stuff can be done using REST and oData Interface.  I will explain this in another post.

CSOM, REST and SharePoint 2013 Search


SharePoint 2013 introduce couple of new ways to access Search Feature in custom applications.  SharePoint 2010 provided the Served Side Search Object Model and Search.asmx web service which allowed us to use Search in Custom apps but there was no access from client.  Now you can call Search from either CSOM or REST.  Even at this moment there is not enough information available out there to completely understand and demo the feature.  But I was able to make it work.

CSOM is more traditional approach if you are developing application for .NET, Silverlight.  Simply Add Reference to

Microsoft.SharePoint.Client.dll

Microsoft.SharePoint.Client.Runtime.dll

These assemblies are necessary as the base implementation of CSOM is part of these assemblies.

Additionally you have to add reference to SharePoint 2013 Search Client OM DLL. which is

Microsoft.SharePoint.Client.Search.dll

Now you can write the C# code to Query and Parse the Result.

using (ClientContext context = new ClientContext(new Uri("http://intranet.contoso.com/sites/Search/")))

{

        context.Credentials = System.Net.CredentialCache.DefaultCredentials;

        KeywordQuery keywordQuery = new KeywordQuery(context);

        if (textBox1.Text.Length == 0)

        {

            MessageBox.Show("Please enter Title in Text Box to Save.");

            return;

        }

        keywordQuery.QueryText = textBox1.Text;

 

        SearchExecutor searchExec = new SearchExecutor(context);

        ClientResult<ResultTableCollection> Results = searchExec.ExecuteQuery(keywordQuery);

        context.ExecuteQuery();

 

        if (Results != null)

        {

            if (Results.Value[0].RowCount > 0)

            {

                DataTable dt = new DataTable();

 

                dt.Columns.Add("Title");

                dt.Columns.Add("Path");

                dt.Columns.Add("Write");

                dt.Columns.Add("Author");

                dt.Columns.Add("Rank");

 

                foreach (var Row in Results.Value[0].ResultRows)

                {

                    DataRow dr = dt.Rows.Add();

                    if (Row["Title"] != null)

                    {

                        dr[0] = Row["Title"].ToString();

                    }

                    else

                        dr[0] = Row["AccountName"].ToString();

 

                    dr[1] = Row["Path"].ToString();

                    dr[2] = Row["Write"].ToString();

                    dr[3] = Row["Author"].ToString();

                    dr[4] = Row["Rank"].ToString();

                }

 

 

                dataGridView1.DataSource = dt.DefaultView;

            }

            else

            {

                MessageBox.Show("No Results Found for your Query " + textBox1.Text);

            }

        }

        else

        {

            MessageBox.Show("No Results Found for your Query " + textBox1.Text);

        }

        

 

 

}

As almost every CSOM method has its REST Endpoint now SharePoint 2013 now also provide an effective way to using Search using REST and oData.  First you have to make a httpRequest object using oData and make a GET request which will be passed to AJAX. 

For this sample I created a SharePoint Hosted App.  I added a Text Box and Button to the page and a Result Div that will show the output to the user  (Very Normal way in HTML apps)

“Another thing to know that this SharePoint app will not work until you give it permission to use Search.”  You have to double click on application manifest file and inside permission choose Search.

While Executing the app the app will ask for user permission to allow it to run Search. 

First you have to understand the URL convention of the Search 2013 REST.  To make Search using REST you have to using URL in the format of

SiteURL/host/_api/Search/Query?QueryText=’Text Keyword’

You can also perform a Query to get Query Suggestions using Sugges Instead of Query

SiteURL/_api/search/suggest?querytext=’keyword needed suggestion’

You can read all about Search and performing Search from here

The Result will return in JSON format which you have to parse.  The Results are included in d:RelevantResults section of the output XML.  This section include all the properties you need to display results to the end users.  the results include almost everything that you need from keywords, Tags, Image Thumbnails etc.

I will post about making Query using Fiddler and then from SharePoint App tomorrow.