JQuery Draggable,Droppable and Sortable items between two containers(div tags)

HTML markup for this:

Media Buttons

Facebook

Twitter

GooglePlus

LinkedIn

Pinterest

Selected Button(s)

Javascript:

$(".draggable").draggable({ cursor: "crosshair", revert: "invalid"});
$("#drop").droppable({ accept: ".draggable",
drop: function(event, ui) {
$(this).removeClass("border").removeClass("over");
var dropped = ui.draggable;

var droppedOn = $(this);
$(dropped).detach().css({top: 0,left: 0}).appendTo(droppedOn);
var htmlArr = [];$(‘#drop p’).map(function(index,element){console.log(htmlArr.push($(element).html()))});
console.log(htmlArr.join(‘;’))

},
over: function(event, elem) {
$(this).addClass(“over”);
}
,
out: function(event, elem) {
$(this).removeClass(“over”);
}
});
$(“#drop”).sortable();
$( “#drop” ).disableSelection();
$(“#origin”).droppable({ accept: “.draggable”, drop: function(event, ui) {
$(this).removeClass(“border”).removeClass(“over”);
var dropped = ui.draggable;

var droppedOn = $(this);
$(dropped).detach().css({top: 0,left: 0}).appendTo(droppedOn);

}});

 

JSFiddle example demo for this:

http://jsfiddle.net/39khs/1287/

Start or stop a service (SharePoint 2013) using powershell

To get all SPServiceInstance names , Run below command.

Get-SPServiceInstance

To start or stop the service, run below commands:

//Get the service instance from your server

$service = $(Get-SPServiceInstance |where {$_.TypeName -match "Microsoft SharePoint Foundation Web Application" } |where {$_.Server -match "SPServer Name=yourservername"})

Stop the service by using below command:

$service.Unprovision()

Start the service by using below command:

$service.Provision()

Powershell Command to Change the value of RevertToSelfAllowed for Service Application

First you need to check the name of your Business Data Connectivity Service Application
– a quick way is to check the UI, or you could use a PowerShell Cmdlet or use the API. I’m just using the UI for easy access:

image

Use the below command to Update the RevertToSelfAllowed value.

$bcsServiceApp = Get-SPServiceApplication | where {$_ -match “Business Data Connectivity Service”}

$bcsServiceApp.RevertToSelfAllowed = $true;

$bcsServiceApp.Update();

Increase Database Throttle Level using PowerShell Command

When we are using Business Connectivity Services (BCS) to leverage External Content Type may run into an issue if the external data they are referencing has over 2000 rows (by default). 

This typically presents itself as dialog box with no values in it when they attempt to index BCS Column.

To modify the Throttle value You can run these following  commands..

$bcs = Get-SPServiceApplicationProxy | where{$_.GetType().FullName -eq (‘Microsoft.SharePoint.BusinessData.SharedService.’ + ‘BdcServiceApplicationProxy’)}

$BCSThrottle = Get-SPBusinessDataCatalogThrottleConfig -Scope database -ThrottleType items -ServiceApplicationProxy $bcs

Set-SPBusinessDataCatalogThrottleConfig -Identity $BCSThrottle -Maximum 1000000 -Default 200000

Retrieve Log event based on CorrelationId using PowerShell Command

In SharePoint , we will get a Correlation ID (which is a GUID) attached to your logs/error messages when something went wrong. This ID can be used to lookup that specific error from the logs. Correlation ID will be the best starting point for searching problem along that request.

By using this Command you can retrieve the log.

get-splogevent | ?{$_.Correlation -eq “f4385bd3-b40a-4b3a-8c37-d42dc68b36b3”} | select Area, Category, Level, EventID, Message | Format-List

Some times you will get an error like this. So by using Correlation ID you can trace the Log message by above command…

 

Building global navigation in SharePoint 2013 using Global Termset

Building global navigation in SharePoint 2013 using Global Termset

Having the global nav which will read from a single termset and feed into different site collections from same termset. Global nav which is reading from the termset  in  one site collection will not be able to use same termset in another site collection. For that we need to create separate termset for global nav in other site collection.So rather than creating  same termset in every site collection we will create Global Termset. This link will be useful for when the navigation URL’s are same for all site collections.

SP 2013 has a bug where one Term Set collection can only be assigned to one site collection navigation. If there are different navigation URL’s for different sites then we need to customize the global nav by reading Navigation terms and URL’s from one xml file. This is the only one option left to feed Global Nav from one same place.

Different Feild Types(Site Columns) Programatically

<Field ID=”{5DAC5B08-D4CE-497F-85F3-7E46277F0575}” Name=” Estimated Cost” DisplayName=”Cost”  Type=”Currency” Decimals=”2″ Min=”0″ Required=”FALSE” Group=”Project List Columns” ></Field>

<Field ID=”{1AD486DE-05DC-4E7C-BA0A-AEA762FF6FBA}”  Name=”Ranking” DisplayName=”Ranking” Required=”FALSE” Group=” Project List Columns”  Type=”Number” SourceID=”http://schemas.microsoft.com/sharepoint/v3″ ></Field&gt;

<Field ID=”{9D3EE5EC-7614-4E84-9048-44BFAA30CD1E}” Name=”TrackingPMOSiteTemplate” DisplayName=”Display Name” Required=”FALSE” Group=” Project List Columns” Type=”Boolean”  SourceID=”http://schemas.microsoft.com/sharepoint/v3″ ></Field&gt;

<Field ID=”{943E7530-5E2B-4C02-8259-CCD93A9ECB18}” Name=”CostCenter” DisplayName=”Cost Center” Required=”FALSE” Type=”Choice”  Group=”Financial Columns”>
<CHOICES>
<CHOICE>Administration</CHOICE>
<CHOICE>Information</CHOICE>
</CHOICES></Field>

<Field ID=”{20ED0EB1-06A7-4B5D-8212-7FB649057F07}” Name=”TechnicalLead” DisplayName=”Technical Lead” Required=”FALSE”  Mult=”TRUE” Sortable=”FALSE” Group=” Project List Columns”
Type=”TaxonomyFieldTypeMulti” ShowField=”Term1033″  >
<Customization>
<ArrayOfProperty>
<Property>
<Name>TextField</Name>
<Value xmlns:q6=”http://www.w3.org/2001/XMLSchema&#8221; p4:type=”q6:string” xmlns:p4=”http://www.w3.org/2001/XMLSchema-instance”&gt;
{75970F68-DCF0-4BDF-8A61-AC1612448A7B}
</Value>
</Property>
</ArrayOfProperty>
</Customization></Field>

<Field ID=”{9B22AFD3-179B-49BD-8837-AF0F776C5914}”  Name=”ScopeStatement” StaticName=”ScopeStatement” DisplayName=”Scope Statement”  Type=”Text” MaxLength=”255″ Required=”FALSE” Group=” Project List Columns”></Field>

<Field ID=”{D1DCF150-52FB-4CC5-A974-83DC87D5940A}” Name=”ProjectDescription” DisplayName=”Project Description”
Type=”Note” NumLines=”40″ RichText=”TRUE” RichTextMode=”FullHtml” IsolateStyles=”TRUE” Required=”False” Group=” Project List Columns”></Field>

<Field ID=”{6183A68E-9F25-4708-812C-B821C1158F4E}”  Name=”LaunchDate”  DisplayName=”Launch Date”        Type=”DateTime” Format=”DateOnly”  Required=”FALSE”  Group=”Project List Columns”><Default>[today]</Default></Field>

<!– Primary lookup column: CustIDLookup –>
<Field Type=”Lookup” Name=”CustIDLookup” ID=”{2A670022-84AF-4C51-84F7-8E1B6025F104}” List=”Lists/Contoso Customers”
ShowField=”ID”  DisplayName=”Customer ID” Required=”true” Group=”Contoso Columns”></Field>
<!– Secondary lookup column: CustFirstNameLookup –>
<Field Type=”Lookup” FieldRef=”2A670022-84AF-4C51-84F7-8E1B6025F104″ Name=”CustFirstNameLookup”
ID=”{F0AF2CA5-EA71-46F7-9536-036539BA8C5C}”  List=”Lists/Contoso Customers”  ShowField=”FirstName”
DisplayName=”First Name” Required=”false” Group=”Contoso Columns” ReadOnly=”TRUE” ></Field>

 

 

SPMonitoredScope Class

The SPMonitoredScope class resides in the Microsoft.SharePoint.Utilities namespace.

SPMonitoredScope is very easy to use. A developer simply “wraps” the section of code to be monitored. Then, as the code is executed, the measured statistics are written to the ULS logs as well as to the Developer Dashboard.

using (new SPMonitoredScope(“My Scope Name”, Microsoft.SharePoint.Administration.TraceSeverity.Medium,null))
{

        callCode();

}

 

Creating search scopes programatically using SPNavigation class

To add search scopes programatically, By using SPNavigation class we can achieve this.

SPSite site = properties.Web.Site as SPSite;

string searchscopeURL = properties.ListItem[“ACSSearchScopeURL”].ToString();

SPNavigationNode AllContentNode = new SPNavigationNode(properties.ListItem[“Title”].ToString(), searchscope, true);

site.RootWeb.Navigation.SearchNav.AddAsLast(AllContentNode);

site.RootWeb.Update();