Sunday 30 March 2014

SharePoint 2013 Open With Explorer is not working

SharePoint 2013 Open With Explorer is not working
Solution:
While login to SharePoint Online.
Check: Keep me signed in
Now try it.

SharePoint Difference between Backup/Restore and Export/Import

Difference between Backup/Restore and Export/Import

Backup-SPSite:

Backup-SPSite is generally used when you want to replicate the entire site collection (including all subsites) to an existing web application.

It allows you to backup either a site collection or web application.
You can basically consider the file generated more or less as a SQL dump of (a part of) your content database.It preserves the GUID of every object except the GUID of the Site.
When you restore the backup, SharePoint generates a new GUID for the site collection.

Export-SPWeb:
Export-SPWeb is generally used when you want to replicate just a single subsite to an existing site collection, that allows you to backup data of a sub site (SPWeb object), but it can also export a site collection, an entire web application, or a single list. It generates a new GUID for every objects such as sites, sub sites, lists and items.

A major drawback of this operation is that it does not preserves workflows instances, associations, history and tasks.Every workflow association must be recreated and there is no way to restore the running instances from original site.

Export/import is often used to split site collections into multiple pieces when they reached a certain limit. Or to do the vice versa and consolidate multiple site collections into one larger one. Both of these actions work fine as long as the migrated content does not use the publishing feature.

Example for Subsite backup and restore:

Export-SPWeb -Identity http://spsdemo:9999/Subsite1 -Path "D:\Exports\Subsite1"
Import-SPWeb http://spsdemo:6666/Subsite2 -Path "D:\Exports\Subsite1.cmp"

Example for list backup and restore:

Export-SPWeb http://spsdemo:9999/ -ItemUrl "/Lists/Test%20docs/" -Path "D:\Exports\TestDoc"
Import-SPWeb -Identity http://spsdemo:6666 -Path "D:\Exports\TestDoc.cmp"

Friday 28 March 2014

How to find a managed property name in SharePoint 2013

How to find a managed property name in SharePoint 2013
Open SharePoint site
Settings
Site Settings
find: Search Schema (Under ...Site Collection Administration)
Click on: Search Schema
Type your site column name which you want to find Managed property, at Managed property Text box.
Click --> button.
You will find Managed property of your site column.
Note: SharePoint will automatically create managed properties for site columns.
So when you are working with Crawl, create a site column and add that site column to List.

Sharepoint SPQuery vs SPSiteDataQuery

Sharepoint SPQuery vs SPSiteDataQuery
The SPQuery class is used to build query strings to filter or retrieve the specific set of data programmatically from a SP List object.
Syntax: SPQuery query = new SPQuery();
query.Query = <Where><Eq><FieldRef Name= “colname”/><Value type=”text”>filter parameter</value></Eq></Where>;
SPSiteDataQuery is used for cross-site and cross-list searching. SPSiteDataQuery can be used to search in all lists of a particular list type or list base type located in either the complete site collection or a particular site and sub-sites.
SPSiteDataQuery query = new SPSiteDataQuery();
query .ViewFields = “<FieldRef Name=”Title”/>”;
query .Lists = “<Lists ServerTemplate=”101″/>”;
query .Webs = “<Webs Scope=”SiteCollection”/>”;
query .Query = “<Where>” +
“<Contains>” +
“<FieldRef Name=”Title”/>” +
“<Value Type=”Text”>Conditional Parameter </Value>” +
“</Contains>” +
“</Where>”;
SPSite site = new SPSite(http://SP2010);
SPWeb web = site.OpenWeb();
DataTable dt = web.GetSiteData(query);
dt.Rows[0]["Title"]);
Points To Remember
Eq = Equal.
NEq= not equal conditions.
FieldRef Keeps the column name on which we want to apply the query.
Value Keeps the parameter for the query column.
We can use / before column name with / tags to have the corresponding NULL condition checks.

Thursday 27 March 2014

The playback failed to find the control with the given search properties

The playback failed to find the control with the given search properties

The playback failed to find the control with the given search properties
The playback failed to find the control

Solution: Please check Your SilverLight Devlopment Code weather Automation Id which you are using in Coded UI Test is there in Dev code or not.
If that Automation Id is not available then your coded UI application will give above error.
Please add Automation Ids for all the controls and run Coded Ui Bilder then it will work.

SCRIPT5009: 'NotifyScriptLoadedAndExecuteWaitingJobs' is undefined

SCRIPT5009: 'NotifyScriptLoadedAndExecuteWaitingJobs' is undefined
Add: <script type="text/javascript" src="/_layouts/15/sp.taxonomy.js"></script>

Make sure you are adding all below script references and with same order.
<script type="text/javascript" src="../Scripts/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="/_layouts/15/MicrosoftAjax.js"></script>
<script type="text/javascript" src="/_layouts/15/init.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.taxonomy.js"></script>

K2 blackpearl Connections Strings

K2 blackpearl Connections Strings
When creating a programmatic connection to K2 (typically via either the SourceCode.Workflow.Client or SourceCode.Workflow.Management APIs) there are a number of connection options that can be used. I wanted to highlight a couple of common scenarios here.
First of all, the easiest way to create a K2 connection string is via the SCConnectionStringBuilder (SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder). I will show 3 common connection string builder scenarios.

Some basic assumptions before we begin:
- These examples will assume the default blackpearl security lables are in place, where the 'K2' security label equates to Active Directory and the 'K2SQL' security label works with the SQL User Manager.
- Connection strings to the workflow server are shown (as denoted by the port = 5252) for use when making a Workflow.Client connection. If you wish to connect to Workflow.Management or SmartObjects.Client, then you will use port 5555.

1. Make a connection under the currently Windows Identity that is running this code:
SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder builder =
new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();
builder.Authenticate = true;
builder.Host = "localhost";
builder.Port = 5252;
builder.Integrated = true;
builder.IsPrimaryLogin = true;
builder.SecurityLabelName = "K2";

2. Force the connection under a specific AD Identity
(Note: a Domain Name, User ID and Password must be provided)
SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder builder =
new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();
builder.Authenticate = true;
builder.Host = "localhost";
builder.Port = 5252;
builder.Integrated = true;
builder.IsPrimaryLogin = true;
builder.SecurityLabelName = "K2";
builder.WindowsDomain = "k2demo";
builder.UserID = "carolm";
builder.Password = "k2pass";

3. Make a connection that authenticates against the K2 SQL User Manager
SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder builder =
new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();
builder.Authenticate = true;
builder.Host = "localhost";
builder.Port = 5252;
builder.Integrated = false;
builder.IsPrimaryLogin = true;
builder.SecurityLabelName = "K2SQL";
builder.UserID = "jdoe";
builder.Password = "k2pass";
Once you have the connection string builder populated you can use it in the various API connections.

For example, some common ones:
1. SourceCode.Workflow.Client (for workflow interaction)
NOTE: the port used here would be 5252
SourceCode.Workflow.Client.Connection oConn = new SourceCode.Workflow.Client.Connection();
oConn.Open("localhost", builder.ConnectionString);
2. SourceCode.Workflow.Management (for administrative functionality)
NOTE: the port used here would be 5555
SourceCode.Workflow.Management.WorkflowManagementServer oConn = new SourceCode.Workflow.Management.WorkflowManagementServer();
oConn.CreateConnection();
oConn.Connection.Open(builder.ConnectionString);
3. SourceCode.SmartObjects.Client (for SmartObject interaction)
NOTE: the port used here would be 5555
SourceCode.SmartObjects.Client.SmartObjectClientServer oConn = new SourceCode.SmartObjects.Client.SmartObjectClientServer();
oConn.CreateConnection();
oConn.Connection.Open(builder.ConnectionString);

Tuesday 25 March 2014

The server is busy now. Try again later

The server is busy now. Try again later
Try to close all window and open in private window...now it should work

SharePoint 2010: Workflow failed to run after pause

Consider the following scenario:
 
A SharePoint 2010 farm has a Web Front End Server with the “Microsoft SharePoint Foundation Web Application” service running and a separate Application Server with the “Microsoft SharePoint Foundation Workflow Timer Service” running (The server does not have the Web Application service running).
A workflow has been queued for resumption and the Application server with the Workflow Timer Service tries to resume the workflow but fails.
 
In this scenario the application server fails to resume the Workflow timer service and the workflow gets stuck in "In progress" status. The Workflow History list shows "workflow failed to run." message
 
SharePoint ULS log entries may include the following:
 
OWSTIMER.EXE (0x0E5C) 0x2184 SharePoint Foundation Workflow Infrastructure 72fu Unexpected Load Workflow Class: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.SharePoint.Workflow.SPWinOeHostServices.EnsurePluggableServices(SPSite site, SPWorkflowExternalDataExchangeServiceCollection services, ExternalDataExchangeService existingServices) at Microsoft.SharePoint.Workflow.SPWinOeHostServices..ctor(SPSite site, SPWeb web, SPWorkflowManager manager, SPWorkflowEngine engine)
 
OWSTIMER.EXE (0x0E5C) 0x2184 SharePoint Foundation Workflow Infrastructure 98d8 Unexpected System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.SharePoint.Workflow.SPWinOeHostServices.EnsurePluggableServices(SPSite site, SPWorkflowExternalDataExchangeServiceCollection services, ExternalDataExchangeService existingServices) at Microsoft.SharePoint.Workflow.SPWinOeHostServices..ctor(SPSite site, SPWeb web, SPWorkflowManager manager, SPWorkflowEngine engine)
 
OWSTIMER.EXE (0x0D64) 0x0E98 SharePoint Foundation Workflow Infrastructure frg9 Medium Workflow could not be run because SPWebApplication.UpdateWorkflowConfigurationSettings was not previously called, and the Web Application service has been disabled on this server. Call UpdateWorkflowConfigurationSettings or turn on the Web Application service for this server.
 
 
Cause:
 
The Workflow Timer Service tries to read the workflow batchsize settings from the web.config or configuration database for a web application. By default, the batchsize setting is in web.config file if the server is running the Web Application service.
 
If the Web Application service is not running on the same server and script in Method 1 (under the 'Resolution' section) has not been run, the batchsize setting is neither in the web.config file nor in the configuration database, then the operation fails.
 
Solution:
Method 1:
 
Locate one Web Front End server which has Web Application service running, run the following PowerShell command to copy workflow-related configuration from the web.config to the configuration database so it will be available from every server in the Farm.
 
• $webapp = Get-SPWebApplication -identity http://<web app name>
• $webapp.UpdateWorkflowConfigurationSetttings()
 
Method 2:
 
Start the Web Application Service on all servers that have the Workflow Timer Service running.
 
Method 3:
 
Disable the Workflow Timer Service on servers that are not running the Web Application service

Microsoft.SharePoint.SPException: The security validation for this page is invalid. in SharePoint 2010

Microsoft.SharePoint.SPException: The security validation for this page is invalid. in SharePoint 2010
Solution:
Change the web application validation settings in Central Administration > Web Application General Settings Page.
Got to page “Web Page Security Validation” and select Security Validation is “Off” radio button.
But this will off the page validation for the complete web application and you can’t take this risk.
To resolve this we have web application’s from digest settings property which we can turf before executing the code and turn on once the site has been created using the SharePoint object Model.
Disabling the from digest :-
SPWebapplication.FormDigestSettings.Enabled = false;
Enabling the from digest :-
SPWebapplication.FormDigestSettings.Enabled = true;
SPWebapplication’s FromDigestSettings property is type of SPFormDigestSettings which related to Web page security validation. The security validation is specific to a user, site, and time period and expires after a configurable amount of time. When the user requests a page, the server returns the page with security validation inserted. When the user then submits the form, the server verifies the security validation and if it has changed, program execution is halted and a security exception is raised.

The remote server returned an error 401 unauthorized in SharePoint 2013

The remote server returned an error 401 unauthorized in SharePoint 2013
Solution:
System.Security.Principal.WindowsImpersonationContext impersonationContext;
impersonationContext =
((System.Security.Principal.WindowsIdentity)Thread.CurrentPrincipal.Identity).Impersonate();
impersonationContext.Undo();


Friday 21 March 2014

Get-SPSite: Microsoft SharePoint is not supported with Version 4.030319.296 of the Microsoft .Net runtime

Error: Get-SPSite: Microsoft SharePoint is not supported with Version 4.030319.296 of the Microsoft .Net runtime
Solution:

Open powershell -v 2
Add below line and execute.
Add-PsSnapin Microsoft.SharePoint.PowerShell

Monday 17 March 2014

Add Custom 404 error Web page in Microsoft SharePoint Server 2010

Add Custom 404 error Web page in Microsoft SharePoint Server 2010
1- Log on to the computer that is running SharePoint Server 2010 by using an account that has administrative permissions.
In Windows Explorer, locate the following folder:
%systemdrive% \Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\[LangID]
LangID: 1033 for English, 1025 for Arabic
2- Create the custom HTML file:
On the computer that is running SharePoint Server 2010, copy the Sps404.html file to a temporary folder.
Rename the Sps404.html file. For example, give the file the following name:
Custom404.html
Add the custom content to the Custom404.html file by using an HTML editor
3- Copy the Custom404.html file to the %systemdrive% \Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ LangID folder.
Same folder from where you have copied Sps404.html file
4- Run the following PowerShell command from the SharePoint 2010 Management Shell:
(Get-SPWebApplication http://sp2010).FileNotFoundPage = "Custom404.html"
or
$webapp =Get-SPWebApplication http://<serverUrl>:<port>
$webapp.FileNotFoundPage = "Custom404.html"
$webapp.update()
5- Verify that the property is set by running the following command:
(Get-SPWebApplication http://<serverUrl>:<port>).FileNotFoundPage
or
$webapp =(Get-SPWebApplication http://sp2010).FileNotFoundPage

Saturday 15 March 2014

How to remove SharePoint 2013 top navigation

How to remove SharePoint 2013 top navigation
Search for: id="DeltaTopNavigation"
Then remove below section.
<SharePoint:AjaxDelta id="DeltaTopNavigation" BlockElement="true" CssClass="ms-displayInline ms-core-navigation" role="navigation" runat="server">
<SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate">
<template_controls>
<asp:SiteMapDataSource
ShowStartingNode="False"
SiteMapProvider="SPNavigationProvider"
id="topSiteMap"
runat="server"
StartingNodeUrl="sid:1002"/>
</template_controls>
</SharePoint:DelegateControl>
<asp:ContentPlaceHolder ID="PlaceHolderTopNavBar" runat="server">
<SharePoint:AspMenu
ID="TopNavigationMenu"
Runat="server"
EnableViewState="false"
DataSourceID="topSiteMap"
AccessKey="<%$Resources:wss,navigation_accesskey%>"
UseSimpleRendering="true"
UseSeparateCss="false"
Orientation="Horizontal"
StaticDisplayLevels="2"
AdjustForShowStartingNode="true"
MaximumDynamicDisplayLevels="2"
SkipLinkText="" />
</asp:ContentPlaceHolder>
</SharePoint:AjaxDelta>--%>

SharePoint 2013 How to hide main Content Place holder

SharePoint 2013 How to hide main Content Place holder
Open Master page. Search for "contentBox".
Add style="visibility: hidden" to <div id="contentBox"
Final Code:
<div id="contentBox"
aria-live="polite" aria-relevant="all" style="visibility: hidden">
<div id="notificationArea" class="ms-notif-box"></div>
<SharePoint:AjaxDelta id="DeltaPageStatusBar" BlockElement="true" runat="server">
<div id="pageStatusBar"></div>
</SharePoint:AjaxDelta>
<SharePoint:AjaxDelta id="DeltaPlaceHolderMain" BlockElement="true" IsMainContent="true" runat="server">
<a id="mainContent" name="mainContent" tabindex="-1"></a>
<asp:ContentPlaceHolder ID="PlaceHolderMain" runat="server" />
</SharePoint:AjaxDelta>
</div>

SharePoint 2013 hide left navigation

SharePoint 2013 hide left navigation
<style type="text/css">
#sideNavBox{ display:none;} #contentBox { margin-left: 20px!important;}
</style>

SharePoint 2013 Online How to Create Page Layout

SharePoint 2013 Online Creating the Page Layout
1.SharePoint Designer 2013
2.Design Manager
SharePoint Designer 2013 :
Open your web site with SharePoint Designer 2013
Go to the Page Layouts Panel and click on New Page Layout
Name the file JobPostingSPD.aspx->specify JobPostingSPD in the url.
Display the ToolBox Pane by clicking on the View Ribbon-Task Panes menu : the Toolbox Pane will show up on the right side of the window; in the SharePoint Controls group, you will find your Content Type fields :
Open your aspx page and type the following lines in the PlaceHolderMain (we won’t use html tables):
<ul>
<li><span>Title</span></li>
<li><span>Des</span></li>
<li><span>Req</span></li>
</ul>
The good practice when usying css styles is to share them in a separate file.
Now to each </span>, drag and drop the correspond field from the Toolbox :
Also, as a developer it is worth noting that the layout page is derived from the: Microsoft.SharePoint.Publishing.PublishingLayoutPage
Go to the Pages library, add the JobPosting content type.
Go to the Pages library and add a new document : the JobPosting content type should be visible

How to Check SharePoint version installed on the server?

How to Check SharePoint version installed on the server?

Command:
Open Powershell . Run as administrator.
Type below command.

get-spfarm | select BuildVersion

Result:
BuildVersion
------------------
14.0.4762.1000

Another Command:
([Microsoft.SharePoint.Administration.SPFarm]::Local).buildversion

Result:

Major   Minor  Build  Revision
--------   --------   ------   -----------
14           0         4762   1000

Through Central Administration:

Open SharePoint central administration -> Then from the System Settings
click on Manage servers in this farm.

Then in the Manage servers in this farm, you will able to see the version details.

SharePoint Vertical bar issue

SharePoint Vertical bar issue
I was facing vertical bar issue. I am able to see 2 vertical bars in my SharePoint page.
Solution: I found, overflow-y: auto;
tag in my style, i have removed that. It's works fine for me.

SharePoint Client Object Model- C#

SharePoint Client Object Model- C#
using System;
using Microsoft.SharePoint.Client;
using SP = Microsoft.SharePoint.Client;
namespace Microsoft.SDK.SharePointServices.Samples
{
class CreateListItem
{
static void Main()
{
string siteUrl = "http://MyServer/sites/MySiteCollection";
ClientContext clientContext = new ClientContext(siteUrl);
SP.List oList = clientContext.Web.Lists.GetByTitle("Announcements");
ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
ListItem oListItem = oList.AddItem(itemCreateInfo);
oListItem["Title"] = "My New Item!";
oListItem["Body"] = "Hello World!";
oListItem.Update();
clientContext.ExecuteQuery();
}
}
}

Add javascript reference in SharePoint

Add javascript reference in SharePoint
If you have REST based url in your site, you can add your js file using below code...
<script src='<SharePoint:EncodedLiteral runat="server" text="<%$SPUrl:~SiteCollection/MyLibarary/MyProject.js%>" EncodeMethod="HtmlEncode"/>' type="text/javascript"></script>
Or try
<script src="~SiteCollection/MyLibarary/MyProject.js" type="text/javascript"></script>

Delete List Item in Sharepoint 2010 using ClientContext

Delete List Item in Sharepoint 2010 using ClientContext
List list;
ListItem item;
string siteUrl = "http://sp2010";
private void ButtonDelete_Click(object sender, System.Windows.RoutedEventArgs e)
{
ClientContext spContext = new ClientContext(siteUrl);
list = spContext.Web.Lists.GetByTitle("Announcements");
spContext.Load(list);
//We have to pass id dynamically
item = list.GetItemById(2);
item.DeleteObject();
spContext.ExecuteQueryAsync(OnDeleteSuccess, OnFailure);
}
private void OnDeleteSuccess(object sender, ClientRequestSucceededEventArgs args)
{
Dispatcher.BeginInvoke(() =>
{
MessageBox.Show("Item Deleted");
});
}
private void OnFailure(object sender, ClientRequestFailedEventArgs args)
{
Dispatcher.BeginInvoke(() =>
{
MessageBox.Show("Request failed. " + args.Message + "\n" + args.StackTrace);
});
}

sharepoint client object model javascript

sharepoint client object model javascript
Create a SharePoint page.
Add Content editor web part
Open notepad
Add below content
<script type="text/javascript" src="//ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.js"></script>
<script type="text/javascript" src="jquery-1.9.1.js"></script>
<script type="text/javascript" src="_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="_layouts/15/sp.js"></script>
<script type="text/javascript">
var siteUrl = 'http://sp2013/';
function Update() {
var ListName = "Mylist";
var context = new SP.ClientContext.get_current(); // the current context is taken by default here
//you can also create a particular site context as follows
var lstObject = context.get_web().get_lists().getByTitle(ListName);
this.lstObjectItem = lstObject.getItemById(1);
lstObjectItem.set_item('Title', 'This is updated item');
lstObjectItem.update();
lstObject.set_description("Updated description using ECMAScript");
lstObject.update();
context.executeQueryAsync(Function.createDelegate(this, this.onSuccess),
Function.createDelegate(this, this.onFailure));
}
function onSuccess() {
alert('Item udated');
}
function onFailure(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
function Delete() {
var ListName = "Mylist";
var context = new SP.ClientContext.get_current(); // the current context is taken by default here
//you can also create a particular site context as follows
//var context = new SP.ClientContext('/Sites/site1');
var lstObject = context.get_web().get_lists().getByTitle(ListName);
this.lstObjectItem = lstObject.getItemById(3);
lstObjectItem.deleteObject();
context.executeQueryAsync(Function.createDelegate(this, this.onSuccessD),
Function.createDelegate(this, this.onFailureD));
}
function onSuccessD() {
alert('Item Deleted');
}
function onFailureD(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
</script>
<input type="button" id="btnu" onclick="Update(); return false;" value = "Update Item" />
<input type="button" id="btnD" onclick="Delete(); return false;" value = "Delete Item" />
Upload in to SharePoint.
Copy the file location (URL)
Edit Content editor web part
Provide url which you get from above step in “Content Link” section.
Save.

sharepoint list client object model getItems using query

sharepoint list client object model getItems using query
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef Name=\'MyColumn\'/>' +
'<Value Type=\'Text\'>Test</Value></Eq></Where></Query></View>');
--------------------
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' +
'<Value Type=\'Number\'>1</Value></Geq></Where></Query><RowLimit>10</RowLimit></View>');
this.collListItem = oList.getItems(camlQuery);

SharePoint web part layout hidden disabled

SharePoint web part layout hidden disabled
I am trying to hide a webpart from sharepoint page.
When i check Webpart properties, Layout hidden option is disabled.
Work arround.
I have created a new group in SharePoint.
Don't add any user to that group.
Now go to Webpart which you are trying to hide in the page.
Click Edit web part
Expand Advanced section
You can find : Target Audiences
Enter the name of the group which you have created.
Ok
Save
Now your webpart will not visible to other users, but you will able to see it.

How to find Browser Session Storage size

How to find Browser Session Storage size
Open browser... press F 12.
Click on  console
Type below code
window.sessionStorage.remainingSpace

Add new favicon.ico file in SharePoint 2010

Add new favicon.ico file in SharePoint 2010
Open SharePoint 2010 Designer.
Open v4.master in left navigation under Master Pages
Search for SPShortcutIcon
<SharePoint:SPShortcutIcon runat="server" IconUrl="/_layouts/images/favicon.ico"/>
Here you can change the name of ico, by adding ico icon in the below folder.
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IMAGES

SharePoint CSOM javascript Get List Fields

SharePoint CSOM javascript Get List Fields
var fields;
function GetFieldsForList(ListName)
{
var ctx = new SP.ClientContext.get_current();
var list = ctx.get_web().get_lists().getByTitle(ListName);
this.fields = list.get_fields();
ctx.load(fields, 'Include(Title,InternalName)');
ctx.executeQueryAsync(Function.createDelegate(this, this.Success), Function.createDelegate(this, this.Failure));
}
function Success()
{
var _fields = '';
var lEnum = fields.getEnumerator();
while(lEnum.moveNext())
{
_fields += lEnum.get_current().get_title() + " - " + lEnum.get_current().get_internalName() + ";";
}
alert(_fields);
}
function Failure(sender, args)
{
alert("Failed" + args.get_message());
}

Make a term set available to other site collections

Make a term set available to other site collections
After you create a term set on the authoring site collection, you have to make it available to publishing site collections. You can make a term set available to all site collections or to specific site collections.

To make a term set available to all site collections

  1. Verify that the user account that performs this procedure is a member of the Owners SharePoint group on the authoring site that contains the catalog.
  2. On the authoring site, on the Settings menu, click Site Settings.
  3. On the Site Settings page, in the Site Administration section, click Term store management. If the user that performs this procedure is already a member of the Term Store Administrators group, you can skip to step 7.
  4. In the Term Store Management Tool, verify that Managed Metadata Service is selected.
  5. In the Term Store Administrator section, type one or more user names.
  6. Click Save.
  7. Right-click Managed Metadata Service, and then select New Group.
  8. Type the name of the global term set that you want to create, and then press Enter.
  9. Refresh the page.
  10. Right-click the term set that you want to make available to all site collections, and then click Move Term Set.
  11. In the Term Set Move dialog box, click the global term set that you want to move the term set to, and then click OK.
  12. Refresh the page.

To make a term set available to specific site collections

  1. Verify that the user account that performs this procedure is a member of the Owners SharePoint group on the authoring site that contains the catalog.
  2. On the authoring site, on the Settings menu, click Site Settings.
  3. On the Site Settings page, in the Site Administration section, click Term store management.
  4. In the Term Store Management Tool, click the group that contains all term sets within the site collection.
  5. In the Site Collection Access section, type the URLs of the site collections to which you want to make the term set available — for example, http://<site>/sites/products.
  6. Click Save.

How to create draft items in SharePoint List

How to create draft items in SharePoint List
By default all items will be published in List. So all items will able to see end user...if you want to secure any item to end user...follow below steps..
Create a List.
List Settings:
Enable version
Required content: yes
Draft item Security: Only users who can approve items..
Create new item in list
In the Search , Public user (End User) will not able to see the newly added item unless it is approved.
But Authors will able to see the data in search result.
IN this way we can create draft version in SharePoint list.

Friday 14 March 2014

Add Javascript in SharePoint Webpart page

Add Javascript in SharePoint Webpart page
Add new webpart page
Open that page using SharePoint designer
Search for : PlaceHolderAdditionalPageHead
You will find
<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
....
...
..
</asp:Content>
Before closing </asp:Content> tag
Add below script
<script type="text/javascript" src="jquery-1.9.1.js"></script>
<script type="text/javascript">
$( document ).ready(function() {
alert('Test');
});
</script>
Save
preview

sharepoint Data view web part remove new item option

Data view web part sharepoint 2010 remove new item option
Open webpart page in SharePoiunt designer which is having Data View webpart.
You will find this section:
<SharePoint:StyleBlock runat="server">
If not add below tag inside <asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
<SharePoint:StyleBlock runat="server">
td.ms-addnew { display:none; }
</SharePoint:StyleBlock>
Save
New item will remove from data view web part

SharePoint Finding TaxonomyHiddenList

SharePoint Finding TaxonomyHiddenList
[site url]/Lists/TaxonomyHiddenList/AllItems.aspx

sharepoint list client object model getItems using query

sharepoint list client object model getItems using query
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef Name=\'MyColumn\'/>' +
'<Value Type=\'Text\'>Test</Value></Eq></Where></Query></View>');
--------------------
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' +
'<Value Type=\'Number\'>1</Value></Geq></Where></Query><RowLimit>10</RowLimit></View>');
this.collListItem = oList.getItems(camlQuery);

SharePoint Hide page name from Master Page

SharePoint Hide page name from Master Page:
Open Master page.
Search for : pageContentTitle
Add style as hidden
Save.

SharePoint 2013 add Edit new webpart page

SharePoint 2013 add new webpart page
Add New page
Try to edit the page..
Message: this page cannot be edited in sharepoint designer. you can edit the content in the browser
To solve above messgae..
Click on pages.Right Click on page which you want to edit.
Select : Detach from page layout
Now add some javascript: You should add javascript in :PlaceHolderMain only
Add javascript inside: <asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server">
<script type="text/javascript">
alert('hi');
$(document).ready(function() {
var k="str";
alert(k);
});
</script>
SharePoint Add javascript in Allitems.aspx
Open Allitems.aspx
Search for : PlaceHolderMain
After : <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server"> tag add javascript
Looks like this...
<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<script type="text/javascript" src="/jquery-1.9.1.js"></script>
​<script type="text/javascript">
$( document ).ready(function() {
alert('kk');
});

SharePoint Managed Metadata column query

SharePoint Managed Metadata column query
SelectCommand="&lt;View&gt;&lt;Query&gt;&lt;Where&gt;&lt;In&gt;&lt;FieldRef Name=&quot;Term&quot; LookupId=&quot;TRUE&quot; /&gt;&lt;Values&gt;&lt;Value Type=&quot;Integer&quot;&gt;{Param1}&lt;/Value&gt;&lt;/Values&gt;&lt;/In&gt;&lt;/Where&gt;&lt;/Query&gt;&lt;/View&gt;"


Or

SelectCommand="<View><Query><Where><In><FieldRef Name='Term' LookupId='TRUE' /><Values><Value Type='Integer'>{Param1}</Value></Values></In></Where></Query></View>"

SharePoint List read managed Metadata
Use below javascript code to read Managed Metadata
function onSuccess(sender, args) {
var objlistEnumerator = objlistItems.getEnumerator();
while (objlistEnumerator.moveNext()) {
var objListItem = objlistEnumerator.get_current();
var i;
var cc=objListItem.get_item('MMDCol').get_count();
for (i=0;i<cc;i++){
alert(objListItem.get_item('MMDCol').get_item(i).$0_1);//Term
alert(objListItem.get_item('MMDCol').get_item(i).$1_1);//Guid
alert(objListItem.get_item('MMDCol').get_item(i).$2_1);//WSSID
}
}
}

SharePoint JS Links

SharePoint JS Links
#1 – JSLink supports multiple JavaScript files
JSLink allows you to attach multiple files. Yes, multiple JavaScript files and I am pretty serious about that. You may set them via “|” separator like this:
“~sitecollection/Style Library/spdevlab/spdevlab.multiple-1.js|~sitecollection/Style Library/spdevlab/spdevlab.multiple-2.js ”
#2 – JSLink supports (d) tag to specify SOD registration
You may specify “(d)” tag-string at the end of the file link. In that case, your file is not going to be loaded immediately, but will be registered with SOD to be queried later.
So, the following JSLink would produce one script including with “script” tag and two SOD registration:
“~sitecollection/Style Library/spdevlab/spdevlab.multiple-1.js|~sitecollection/Style Library/spdevlab/spdevlab.multiple-2.js(d)|~sitecollection/Style Library/spdevlab/spdevlab.multiple-3.js(d)”
The outcome would be like this:
<script type=”text/javascript” src=”/sites/dev4/style%20library/spdevlab/spdevlab.multiple-1.js?ctag=0$$15.0.4420.1017″></script>
Also, you will get the SOD registration for the two other files:
<script type=”text/javascript”>RegisterSod(“~sitecollection/style library/spdevlab/spdevlab.multiple-2.js”, “\u002fsites\u002fdev4\u002fstyle\u002520library\u002fspdevlab\u002fspdevlab.multiple-2.js”);</script>
<script type=”text/javascript”>RegisterSod(“~sitecollection/style library/spdevlab/spdevlab.multiple-3.js”, “\u002fsites\u002fdev4\u002fstyle\u002520library\u002fspdevlab\u002fspdevlab.multiple-3.js”);</script>
That’s interesting, but the SOD key for your JS file would be exactly like the original file name. Even with the tokens such as “~site” or “~sitecollection”.
#3 – You can’t overwrite JSLink for some of the fields
Overriding JSLink property via field xml definition or c# code is a nice way to link your JavaScript file to the particular field. However, not all the fields could be overwritten this way.
For example, Taxonomy field has the following JSLink definition:
// Microsoft.SharePoint.Taxonomy.TaxonomyField
public override string JSLink
{
get
{
return "SP.UI.Taxonomy.js|SP.UI.Rte.js(d)|SP.Taxonomy.js(d)|ScriptForWebTaggingUI.js(d)";
}
}
This means you cannot modify the look and feel for your Taxonomy field. Also, you can’t do that for Taxonomy, Related Items or Task Outcome field. All of these fields return particular JSLink which can’t be changed.
Frankly saying, you still may change look and feel of these fields, but you need to register your JavaScript file on the site collection level and make sure it gets loaded on every page. It could be done with custom action or any other methods to deliver JavaScript file within the site collection scope.
#4 – There are several JavaScript files with client render templates
You may have already seen and explore “clienttemplates.js” file as it has most of the client render definitions for the SharePoint fields. However, there are several JavaScript files with different fields templates. Here they are:
clienttemplates.js – for the most of the fields
Geolocationfieldtemplate.js – for SPFieldGeolocation
sp.ui.relateditems.js – for RelatedItemsField
choicebuttonfieldtemplate.js – for OutcomeChoiceField
SP.UI.Taxonomy.js – for the Taxonomy field
These files could be useful for exploring and learning out of the box API or other tricky stuff for the field rendering in SharePoint 2013. Enjoy!
#5 – There more than ~site/~sitecollection tokens supported by JSLink
In fact, internally, JSLink comes to the ScriptLink web control to register all JavaScript files. As an outcome, JSLink also supports the following tokens:
~site
~sitecollection
~layouts
~siteLayouts
~siteCollectionLayouts
This is quite cool as, for example, ~layouts token depends on the current compatibility level of the target site and could be either “_layouts/14″ or “_layouts/15″. This might be not critical for the custom field rendering, but for something else.


Example:

Catalog Settings Missing in SharePoint

Catalog Settings Missing in SharePoint
Go to site settings
Site Collection Feature
You will find: Cross-Site Collection Publishing
Enable
Now you will able to see Catalog Settings

SharePoint App Model

SharePoint App Model
SharePoint is supporting 3 type of App Development..
1.SharePoint-hosted apps
2.Provider-hosted apps
3. Autohosted apps
1.SharePoint-hosted apps
Provisions an isolated sub web on a parent web. The app webs site gets it’s own unique sub-domain (browser cross domain policy). This is important to separate one app from each other app. Use lists, out-of-box web parts. No server-side code allowed, client JavaScript only.
2.Provider-hosted apps
Bring your own server hosting infrastructure. Use the programming language of your choice and callback to SharePoint via the OData API. There is also an option to create remote event receivers.
3.Autohosted apps
Windows Azure Web Site and SQL Azure Database provisioned automatically when app is installed.

How to add script reference in SharePoint JS Links

How to add script reference in SharePoint JS Links
Open js file.
You will find : (function () {
Inside above tag add :
(window.jQuery || document.write('<script src="//ajax.aspnetcdn.com/ajax/jquery/jquery-1.10.0.min.js"><\/script>'));
Final Code.
(function () {
(window.jQuery || document.write('<script src="//ajax.aspnetcdn.com/ajax/jquery/jquery-1.10.0.min.js"><\/script>'));

Sharepoint js links undefined error

Sharepoint js links undefined error
Some times you will get undeifned error in JS links.
The reason would be the list view is not having that column name. Change the list view in the webpart section it will work.

Read SharePoint managed metadata column from List using ctx

Read SharePoint managed metadata column from List using ctx
Your column name is: MMD
var mmdlabel=ctx.CurrentItem.MMD.Label
var mmdGuid=ctx.CurrentItem.MMD.MMDID

SharePoint Custom Page Layout is missing

SharePoint Custom Page Layout is missing
I have created new page layout, but i am not able to see in the ribbon, when i edit the page.
Solution:
You might have created custom page layout from SharePoint Designer.
To get the Page layout.
Open Site
Click Site Setting
Master pages and page layouts
Click on the page which you have created.
Select Publish this Major version.
Now you will able to see your custom page layout

Thursday 13 March 2014

Microsoft SharePoint Interview

Microsoft SharePoint Interview

Search:
  1. What is the scope?
  2. How will you change the scheduling the scope?
  3. How will you configure search particular files like .pdf or .docx etc
  4. Sharepoint installed on server by default search is configured or not?
  5. How will you to configure search in particular webapplication?

Webpart:
  1. What is webpart?
  2. What is the difference between visual webpart and normal webpart?
  3. When your deployed the visual webpart what are 4 files going to deploy
  4. Tell me the steps to deploy the solution? other than powershell,stsdam tool is there any other way can we deploy the solution?
  5. With out restart the iis can we deploy any custom solutions (webpart)?
  6. What is the difference between sandbox solutions and form solutions?
Timerjob:
  1. What is the timerjob?
  2. How will you debug the timerjob?
  3. How can you deploy timerjob in multiple servers(sharepoint servers)?
Workflow:
  1. What are the new workflows and events in SP2013?
  2. When you will use sequentional workflow and when will you use statemachine workflows?
  3. How can we reopen existing sharepoint visual studio workflow using sharepoint designer?
  4. what is the difference between (2010,2013) spd workflows and vs workflows?
Event Receivers:
  1. What is the difference between event receiver and workflow?(steps and real time scenarios)
  2. Hierarchies of event receivers
General:
  1. What is feature?
  2. What is the scope?
  3. What is feature stapling?
  4. Any idea about installation sharepoint server and configuration?
  5. Some questions are real time scenarios