RSS

Category Archives: Uncategorized

How to setup new SharePoint Framework (SPFx) development Environment & Build your First Client Side Webpart?


Note: As per Microsoft site, The SharePoint Framework is currently in preview and is subject to change. SharePoint Framework client-side web parts are not currently supported for use in production environments.

The SharePoint Framework (SPFx) is the next evolution in SharePoint development

Below are some steps required to setup new SharePoint Framework & Create your first client web part from you client PC

  1. Install Node JS

    • Install NodeJS Long Term Support (LTS) version from here
    • After installation, Typ npm -v to verify the version. Make sure you are running V3 version of npm.
    • You can use nodejs commandline or  CMDER or Windows powershell tool to run npm in windows.
  2. Install Yeoman

    Yeoman is the modern scaffolding tool. It helps you kick-start new projects, and prescribes best practices and tools to help you stay productive.

    • Type npm install -g yo to install Yeoman
    • It is a good idea to check that everything is installed as expected by running commonly used Yeoman commands like below::yo –version
  3. Install Gulp

    Gulp is a javascript task runner that lets you automate tasks such as Bundling and minifying libraries and stylesheets,Refreshing your browser when you save a file,Quickly running unit tests, Copying modified files to an output directory etc.

    • Install the gulp command npm install –global gulp-cli
  4. Install Yeoman SharePoint Generator

    The Yeoman SharePoint web part generator helps you quickly create a SharePoint client-side solution project with the right toolchain and project structure.

    • Enter the following command to install the Yeoman SharePoint generator:
      npm install -g @microsoft/generator-sharepoint
  5. Build your First Client Side Webpart

    1. Open CMDER or Node.js command line
    2. Navigate to your favorite projects folder
    3. Create New Project directory
      md myFirstClientWebpartFolder
    4. Navigate to newly created project directory
      cd myFirstClientWebpartFolder
    5. Create a new Client side webpart by running  Yeoman SharePoint Generator by running below command
      yo @microsoft/sharepoint

      When prompted:

      1. What is your solution name? myFirstClientWebpart
      2. Where do you want to place your files? Use current folder
      3. what is your webpart name?Helloworld
      4. what is your webpart description? Helloworld  description
      5. what framweork would you like to start with? (Use arrow keys to select)
    6. At this point, Yeoman will install the required dependencies and scaffold the solution files along with the HelloWorld web part. This might take a few minutes.
      When the scaffold is complete, you should see a Congratulations message.
  6. Run application using Gulp

    To run the application type  gulp serve to play with it.

  7. Open application in code editor

    Use your favorite code editor to explore the new file structure and code
    my recommendation is to use Visual Studio Code which is a  lightweight but powerful source code editor from Microsoft which runs on your desktop and is available for Windows, Mac and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (such as C++, C#, Python, PHP) and runtimes

  8. End of Initial Setup!

    • You are done!
    • Start experimenting new SharePoint development model and build amazing solutions.
    • Happy Coding…Cheers 🙂
Advertisements
 
Leave a comment

Posted by on January 21, 2017 in SharePoint 2016, SPFx, Uncategorized

 

Modern Web Development Stack support by Sharepoint


I’m really excited to know about the new Modern Web Development stack support by SharePoint.

Below are the list of new technologies every SharePoint developer must know

– Node.js & npm
– Gulp
– TypeScript
– Yeoman
– Git
– Office UI Fabric
– Webpack
– React
– Angular
– Knockout
– Handlebars
– Visual Studio Code
– Sublime
– Cmder
– Oh my zsh

Web stack tooling vs classic Microsoft tools

sp

 
Leave a comment

Posted by on December 25, 2016 in Uncategorized, Web Development

 

Tags: , ,

Configuring SharePoint 2013 Search Topology on Production Environment


Introduction

When you create Search Service application from central administration , a default search topology will be created automatically where all Search components are assigned to the server which is running the Central Administration but  in multi servers farm scenario you need to change this topology using PowerShell.

Sample Scenario

In the following scenario I’m using 6 search servers. You can change according to your requirement.

  • 2 Front end servers – running the Query Processing component to handle search query requests from user.
  • 4 Back end Servers – running rest of the search components

SearchTopology

Before You Begin

  1. Make sure you have created a Search service application from central admin
  2. Make sure currently logged user is added as admin in Search service application
  3. Make sure index files are empty, Navigate to search service application administration and see Searchable Item appears as 0

Start configuration

Step 1: Prepare the Topology Variables

$hostA = Get-SPEnterpriseSearchServiceInstance -Identity "SERVER1"

$hostB = Get-SPEnterpriseSearchServiceInstance -Identity "SERVER2"

$hostC = Get-SPEnterpriseSearchServiceInstance -Identity "SERVER3"

$hostD = Get-SPEnterpriseSearchServiceInstance -Identity "SERVER4"

$hostE = Get-SPEnterpriseSearchServiceInstance -Identity "SERVER5"

$hostF = Get-SPEnterpriseSearchServiceInstance -Identity "SERVER6"

 

Start-SPEnterpriseSearchServiceInstance -Identity $hostA

Start-SPEnterpriseSearchServiceInstance -Identity $hostB

Start-SPEnterpriseSearchServiceInstance -Identity $hostC

Start-SPEnterpriseSearchServiceInstance -Identity $hostD

Start-SPEnterpriseSearchServiceInstance -Identity $hostE

Start-SPEnterpriseSearchServiceInstance -Identity $hostF

Note: Wait for a while till above instances get started and proceed below to verify status

Step 2: Check Service status

Get-SPEnterpriseSearchServiceInstance -Identity $hostA

Get-SPEnterpriseSearchServiceInstance -Identity $hostB

Get-SPEnterpriseSearchServiceInstance -Identity $hostC

Get-SPEnterpriseSearchServiceInstance -Identity $hostD

Get-SPEnterpriseSearchServiceInstance -Identity $hostE

Get-SPEnterpriseSearchServiceInstance -Identity $hostF
NOTE: Make sure status is online for all instance, then proceed to next

Step3 : Setting up Topology

NOTE: Make sure below mentioned root directory is created manually on all servers including central admin server

$ssa = Get-SPEnterpriseSearchServiceApplication

$newTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa

NEW-SPENTERPRISESEARCHADMINCOMPONENT -SEARCHTOPOLOGY $NEWTOPOLOGY -SEARCHSERVICEINSTANCE $HOSTA

NEW-SPENTERPRISESEARCHCRAWLCOMPONENT -SEARCHTOPOLOGY $NEWTOPOLOGY -SEARCHSERVICEINSTANCE $HOSTA

NEW-SPENTERPRISESEARCHCONTENTPROCESSINGCOMPONENT -SEARCHTOPOLOGY $NEWTOPOLOGY -SEARCHSERVICEINSTANCE $HOSTA

NEW-SPENTERPRISESEARCHANALYTICSPROCESSINGCOMPONENT -SEARCHTOPOLOGY $NEWTOPOLOGY -SEARCHSERVICEINSTANCE $HOSTA

 

NEW-SPENTERPRISESEARCHADMINCOMPONENT -SEARCHTOPOLOGY $NEWTOPOLOGY -SEARCHSERVICEINSTANCE $HOSTB

NEW-SPENTERPRISESEARCHCRAWLCOMPONENT -SEARCHTOPOLOGY $NEWTOPOLOGY -SEARCHSERVICEINSTANCE $HOSTB

NEW-SPENTERPRISESEARCHCONTENTPROCESSINGCOMPONENT -SEARCHTOPOLOGY $NEWTOPOLOGY -SEARCHSERVICEINSTANCE $HOSTB

NEW-SPENTERPRISESEARCHANALYTICSPROCESSINGCOMPONENT -SEARCHTOPOLOGY $NEWTOPOLOGY -SEARCHSERVICEINSTANCE $HOSTB

 

 

NEW-SPENTERPRISESEARCHQUERYPROCESSINGCOMPONENT -SEARCHTOPOLOGY $NEWTOPOLOGY -SEARCHSERVICEINSTANCE $HOSTC

NEW-SPENTERPRISESEARCHINDEXCOMPONENT -SEARCHTOPOLOGY $NEWTOPOLOGY -SEARCHSERVICEINSTANCE $HOSTC -INDEXPARTITION 0 -RootDirectory “E:\SearchIndex”

 

NEW-SPENTERPRISESEARCHQUERYPROCESSINGCOMPONENT -SEARCHTOPOLOGY $NEWTOPOLOGY -SEARCHSERVICEINSTANCE $HOSTD

NEW-SPENTERPRISESEARCHINDEXCOMPONENT -SEARCHTOPOLOGY $NEWTOPOLOGY -SEARCHSERVICEINSTANCE $HOSTD -INDEXPARTITION 0 -RootDirectory “E:\SearchIndex”

 

NEW-SPENTERPRISESEARCHQUERYPROCESSINGCOMPONENT -SEARCHTOPOLOGY $NEWTOPOLOGY -SEARCHSERVICEINSTANCE $HOSTE

NEW-SPENTERPRISESEARCHINDEXCOMPONENT -SEARCHTOPOLOGY $NEWTOPOLOGY -SEARCHSERVICEINSTANCE $HOSTE -INDEXPARTITION 1 -RootDirectory “E:\SearchIndex”

 

NEW-SPENTERPRISESEARCHQUERYPROCESSINGCOMPONENT -SEARCHTOPOLOGY $NEWTOPOLOGY -SEARCHSERVICEINSTANCE $HOSTF

NEW-SPENTERPRISESEARCHINDEXCOMPONENT -SEARCHTOPOLOGY $NEWTOPOLOGY -SEARCHSERVICEINSTANCE $HOSTF -INDEXPARTITION 1 -RootDirectory “E:\SearchIndex”

Step 4: Activate The Topology

SET-SPENTERPRISESEARCHTOPOLOGY -IDENTITY $NEWTOPOLOGY

Step 5: Verify the Topology

GET-SPENTERPRISESEARCHTOPOLOGY -SEARCHAPPLICATION $SSA

Step 6 : Verify Each Component

GET-SPENTERPRISESEARCHSTATUS -SEARCHAPPLICATION $SSA -TEXT
 

Tags: ,

Sharepoint 2013 Workflow Setup and Configuration Complete Reference


One of the complicated and not well documented feature of SharePoint 2013 is the configuration of new Workflow. I personally struggled a lot to install and configure on my Development and Production environment. Like all i have googled a lot to get bits & pieces of tips and advises from each blog. After successful implementation i thought of consolidate everything and share my experience with you all. Below is a series of post which will focus on Workflow architecture, Configuration, Quality check , Known Issues and Fixes.

Appreciate your valuable comments if you like the series.

Table of contents

Series 1: Overview of SharePoint 2013 Workflow Architecture

Series 2: Setup and Configuration of SharePoint 2013 Workflow

Series 3: SharePoint 2013 troubleshoot checklist

Series 4: SharePoint 2013 Known Issues & Fixes

Series 1: Overview of SharePoint 2013 Workflow Architecture (1 of 4)

  • Workflow is now treated as a service in SharePoint 2013.
  • Workflows now  communicates with Sharepoint via core app model technologies like CSOM / REST.
  • SharePoint 2013 workflows are powered by Windows Workflow Foundation 4, which was substantially redesigned from earlier versions. Windows Workflow Foundation (WF), in turn, is built on the messaging functionality that is provided by Windows Communication Foundation (WCF).
  • It is important to note the relationship between workflow activities and SharePoint actions. Workflow activities represent the underlying managed objects whose methods drive workflow behaviors. Workflow actions, on the other hand, are wrappers that encapsulate the underlying activities and present them in a user-friendly form in SharePoint Designer. Workflow authors interact with the workflow actions, whereas the workflow execution engine acts on the corresponding activities.
  • SharePoint 2010 workflow has been carried forward to SharePoint Server 2013.

High-Level architecture

SharePointJim_WorklowArchitecture_13

Below information is extracted from MSDN article

Workflow Manager Client 1.0 is represented in SharePoint 2013 in the form of the Workflow Manager Client 1.0 Service Application Proxy. This component allows SharePoint to communicate and interact with the Workflow Manager Client 1.0 server. Server-to-server authentication is provided using OAuth.
SharePoint events for which a workflow is listening, like itemCreated, itemUpdated, and so on, are routed to Workflow Manager Client 1.0 using the Microsoft Azure service bus. For the return trip, the platform uses the SharePoint Representational State Transfer (REST) API to call back into SharePoint.
There are also additions to the SharePoint workflow object model, called collectively the Workflow Services Manager, which allow you to manage and control your workflows and their execution. The primary zones of interaction for the services manager are deployment, messaging, instance control, and (for backward compatibility) interoperability with SharePoint 2010 workflows.
Finally, there is the workflow authoring component. SharePoint Designer can now create and deploy both SharePoint 2010 and SharePoint 2013 workflows. Visual Studio 2012 not only provides a designer surface for creating declarative workflows, but it can also create SharePoint Add-ins and solutions that fully integrate Workflow Manager Client 1.0 functionality.

Next >>  Series 2: Setup and Configuration of SharePoint 2013 Workflow (2 of 4)

 
Leave a comment

Posted by on February 24, 2016 in SharePoint 2013, Uncategorized, Workflow

 

Tags: ,

Programatically select and bind Sharepoint list items to ASP.NET controls


  • Open Visual Studio 2010
  • Create New Project
  • Select your Sharepoint site
  • Create Visual Webpart
  • Add LAbels,Textboxes or Dropdownlist (NOTE: Update control names in your code accordingly)
  • Use below code in page load event

try
{

SPQuery query = new SPQuery();
query.Query = “”;
query.ViewFields = “”;
query.RowLimit = 100;

using (SPSite site = new SPSite(SPContext.Current.Web.Url))
{

using (SPWeb web = site.OpenWeb())
{

SPList list = web.Lists.TryGetList(“—ADD LIST NAME—“);

//Check List Exists

if (list != null)

{

//Check ITEMS Exists

if (list.GetItems(query).GetDataTable() != null)
{
DataTableReader rdr = list.GetItems(query).GetDataTable().CreateDataReader();

if (rdr.Read())

//Bind list items to ASP.NET Label

Label1.Text = rdr[“Test_x0020_Item1”].ToString();
Label2.Text = rdr[“TestField2”].ToString();

//To bind DROPDOWNLIST uncomment below code
// dropdownlist1.DataSource = rdr;
// dropdownlist1.DataTextField = “Title”;
// dropdownlist1.DataValueField = “Title”;
// dropdownlist1.DataBind();

//To bind REPEATER uncomment below code
// Repeater1.DataSource = rdr;
// Repeater1.DataBind();

rdr.Close();

}
else
{
lblInfo.Text = “No Items Found”;
}
}
else
{
lblErrorMessage.Text = “List not found.Please make sure list is created and go to webpart settings to add the List name “;
}
}

}
}

catch (Exception ex)
{
lblErrorMessage.Text = ex.Message.ToString();
}

 
 

Tags: ,

Programatically Insert Items to Sharepoint 2010 List using C#.net


  • Open Visual Studio 2010
  • Create New Project
  • Select Your Sharepoint site
  • Create New Visual Webpart
  • Add Textbox,Label and Button as required(NOTE: Controls names You need to update in below code)
  • Add below code in button click event the code

try
{

using (SPSite site = new SPSite(SPContext.Current.Web.Url))
{
using (SPWeb web = site.OpenWeb())
{

SPList List = web.Lists.TryGetList(“—ADD LIST NAME—“);
if (List != null)
{

SPListItem NewItem = List.Items.Add();

{
web.AllowUnsafeUpdates = true;

NewItem[“Title”] = Label1.Text;
NewItem[“Employee Name”] = Label2.Text;
NewItem[“Comments”] = Textbox1.Text;

NewItem.Update();

//int newID = NewItem.ID;

web.AllowUnsafeUpdates = false;

lblInfo.Text = “Item Inserted Successfully.”;

}
}
}

}

}
else
{
lblErrorMessage.Text = “List not found. Configure the list from webpart settings”;
}
}

}
}

catch (Exception ex)
{
lblErrorMessage.Text = ex.Message.ToString();
}

 
2 Comments

Posted by on November 14, 2012 in Code Snippets, Uncategorized, Visual web part

 

Tags: , ,

How to enable list item re-order in SharePoint 2010 custom list?


Enabling list item reorder in share point
  • Create a Custom List and save it as a template (.stp from list settings)
  • Go to the List Template Gallery of your Site Collection (/_catalogs/lt/Forms/AllItems.aspx) and download the template (.stp file) to your computer.
  • Rename the .stp file to a “cab” extension
  • Open the cab file
  • Extract the “Manifest.xml” file
  • Open Manifest.xml” in a text editor then  Search for <UserLists> and add new attribute called OrderedList=TRUE” .
    eg:<List Name=”{XXX XXX XXX XXX}” Title=”Car Models” Description=”” OrderedList=”TRUE” Direction=”0″ ………….. ><MetaData>….
  • Save the file
  • Repackage the manfest.xml into a .cab file (You can use visual studio 2010 to generate .CAB))
  • Change the file extension on the cab file back to .stp
  • Upload the modified Site Template file to site templates
  • Create a new list based on the template
  • Done!

Here is a final step – Add a custom button in the Ribbon to access the reorder quickly

  • Open the list in SharePoint Designer 2010
  • In the ribbon , select the “Custom Actions” drop-down and select “View Ribbon”
  • Provide a name for the button (eg: List Item Order)
  • Click on “Navigate to URL” and enter the following URL: /_layouts/Reorder.aspx?List=ListGUID.
    (You can find the GUID from settings page of your list in SPD2010)
  • Add a small and large icon image
  • Done!
 
1 Comment

Posted by on May 10, 2012 in Uncategorized

 

Tags: