Monday, December 21, 2015

Auto complete feature in SharePoint 2013 list column using SPServices in SharePoint 2013

In this post we will discuss how we can achieve auto complete feature for a column in SharePoint 2013 list using jQuery and SPServices. Here I am have custom list name as "MyProjects" which has one column name as Title and it has data looks like below :


Then I have another list which has two columns one is the default Title column and other one column name is "MyProjectName". And I want the auto complete feature should display the values in the MyProjectName column from the above "MyProjectLists" list (Title column).

For this I have added the below piece of code in the SharePoint list new form in a script editor web part.

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2014.02/jquery.SPServices-2014.02.min.js" type="text/javascript"></script>
    <script type="text/javascript">
       
        $(document).ready(function ()
        {
                $().SPServices.SPAutocomplete({
                sourceList:"MyProjectsList",
                sourceColumn: "Title",
                columnName:"MyProjectName",
                ignoreCase: true,
                numChars: 1,
                slideDownSpeed: 'fast'
        });
    });
    </script>

Now if I will start typing something then the auto complete feature will display the related values.


Friday, September 25, 2015

SharePoint 2013 Interview Questions : Part 1-4

Below are some quick answered SharePoint 2013 Interview Questions:-
1) Describe the Cloud App Model.
The Cloud App Model enables you to create apps. Apps for SharePoint are self-contained pieces of functionality that extend the capabilities of a SharePoint website.
2) What is an App in its most basic form?
A web application that is registered with SharePoint using an app manifest.
3) What is an app manifest?
An app manifest is an XML file that declares the basic properties of the app along with where the app will run and what to do when the app is started.
4) Where can the code for an app run?
SharePoint-hosted apps, Provider-hosted and auto hosted apps, Apps that have a mix of components in SharePoint and in the cloud.
5) How does an app communicate with SharePoint?
a. REST and JavaScript APIs
b. Managed APIs (.NET)
6) How can the app authenticate to SharePoint?
a. Inside SharePoint
b. In the cloud
7) How are apps distributed?
Apps for SharePoint are distributed as an app package.
8) What are some options for app publishing?
a. Public SharePoint app store
b. Organization’s app catalog
9) What is OData?
The Open Data protocol (OData) lets you access a data source, such as a database, by browsing to a specially constructed URL.
10) What is the primary benefit of OData?
Simplified approach for connecting to and working with data sources that are hosted within an organization.
11) What technologies does OData use?
a. HTTP
b. Atom
c. JavaScript Object Notation (JSON)
12) What is OAuth?
An open protocol for authorization.
13) What does OAuth enable?
Secure authorization from desktop and web applications in a simple and standard way.
14) What is OAuth used?
To authorize requests by an app for SharePoint, to access SharePoint resources on behalf of a user and to authenticate apps in the Office Store, an app catalog, or a developer tenant.
15) What is an Access token?
Access tokens are issued by the OAuth security token service (STS) to request app permissions.
16) What are the three types of authorization policies?
user-only policy, user + app policy, or app-only policy.
17) How does an app for SharePoint requests permissions to access SharePoint resources?
An app for SharePoint requests the permissions that it needs during installation from the user who is installing it and then the developer of an app must request, through the app manifest file, the permissions an app needs.
18) Which office technology can be used to build SharePoint 2013 workflows?
Visio 2013 includes a SharePoint 2013 Workflow template that can be used.
19) What is a WebInfo object?
From REST resources it is an object that contains the scalar properties of the site, but that does not include any associated entity sets such as list collections or field collections.
20) What is Client-side rendering?
Client-side rendering provides a mechanism that you can use to produce your own output for a set of controls that are hosted in a SharePoint page.
21) What are remote event receivers?
Remote event receivers handle events that occur to an item in the app, such as a list, a list item, or a web.
22) What is Microsoft Push Notification Service?
Using the Microsoft Push Notification Service (MPNS), Windows Phone apps can receive notifications through the Internet of events triggered on Microsoft SharePoint Server.
23) What are some benefits of the new Geolocation field type?
Allows incorporation of location, maps, and proximity search features into their web and mobile apps and solutions.
24) What is a display template in terms of SharePoint search?
Display templates define the visual layout and behavior of a result type by using HTML, CSS, and JavaScript.
25) What are result types in terms of SharePoint search?
Result types define how to display a set of search results.
26) What is Keyword Query Language (KQL)?
Allows you to specify the search terms or property restrictions that are passed directly to the search service.
27) What is FAST Query Language (FQL)?
FQL is a structured query language that supports advanced query operators.
28) What is meant by a fully declarative workflow?
The workflow is described (literally) in XAML and then executed interpretively at run time.
29) What is the Design Manager?
The Design Manager enables a step-by-step approach for creating design assets that you can use to brand sites.
30) What is the Snippet Gallery?
Allows a user to select a component, configure its properties and update the snippet, copy the HTML snippet that’s generated, and paste that HTML snippet into your HTML file.
31) What are Device channels?
Device channels define channels for one or more devices allowing finely-tuned control over how mobile users experience your site.
32) What is managed navigation?
Managed navigation is the taxonomy-based alternative to the traditional SharePoint navigation feature.
33) What are Catalogs?
Allow you to incorporate lists into your publishing sites.
34)What is cross-site publishing?
Enables you to reuse content across multiple site collections.
35) What is the Machine Translation Service?
The Machine Translation Service is a new service application in SharePoint 2013 that provides automatic machine translation of files and sites.

Tuesday, August 18, 2015

Create a State Machine workflow in SharePoint 2013 designer workflow

One of the most important feature can be achieved in SharePoint 2013 designer workflow as we can achieve state machine workflow in SP2013 designer but not in SP2010/2007.

Below are the steps to create a state machine workflow:
1. Create a workflow in designer
2. Design the workflow by putting stages to the designer.
3. Add your custom actions into it as per below snap.
4. After completion of designing the workflow, publish it.
5. Test with associated list or library.
About these ads
Occasionally, some of your visitors may see an advertisement here.

Adding Button in calculated Field in SharePoint 2013

Add button in the calculated field in SharePoint 2013 list definition:
<Field Name=”Accept” ID=”{1F7328C7-D7F0-4B94-BB15-01859CD28CF2}” DisplayName=”AcceptorDecline” Type=”Calculated” ResultType=”Number” ReadOnly=”TRUE” JSLink=”/_layouts/15/CCAR.SP.Common.Lists/UserRecertification/UserRecertificationScripts.js”>
<Formula>
=”&lt;div id=’divAccept’&gt; &lt;input type=’button’ name=’btnAccept’ id=’btnAccept’ onclick=””UpdateApproveorDecline(‘”&amp;[URID]&amp;”‘,’Yes’)”” value=’Approve’/&gt;
&lt;input type=’button’ name=’btnDecline’ id=’btnDecline’ onclick=””UpdateApproveorDecline(‘”&amp;[URID]&amp;”‘,’No’)”” value=’Decline’ /&gt;&lt;/div&gt;”
</Formula>
<FieldRefs>
<FieldRef Name=”URID” />
</FieldRefs>
</Field>
//UserRecertificationScripts.js code
function UpdateApproveorDecline(URID, ApproveorDecline) {
if (!isEmpty(URID))
{
GetListID(URID, ApproveorDecline);
}
}
function GetListID(URID, ApproveorDecline)
{
if (!isEmpty(URID))
{
var clientContext = new SP.ClientContext.get_current();
if (!isEmpty(clientContext))
{
var webSite = clientContext.get_web();
var list = webSite.get_lists().getByTitle(‘User Recertification’);
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(‘<View><Query><Where><Eq><FieldRef Name=\’URID\’/><Value Type=\’Text\’>’ + URID + ‘</Value></Eq></Where></Query></View>’);
this.collListItem = list.getItems(camlQuery);
clientContext.load(collListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, function (sender, args)
{
var listItemEnumerator = collListItem.getEnumerator();
while (listItemEnumerator.moveNext())
{
//Get the current item then get the item ID
var currentItem = listItemEnumerator.get_current();
//Getting the values to pass to the popup function
var itemid = currentItem.get_item(“ID”);
UpdateListItem(itemid,ApproveorDecline)
}
}),
Function.createDelegate(this, OnLoadFailed));
}
}
}
function UpdateListItem(itemid, ApproveorDecline)
{
if (!isEmpty(itemid))
{
var clientContext = new SP.ClientContext.get_current();
if (!isEmpty(clientContext))
{
var webSite = clientContext.get_web();
var list = webSite.get_lists().getByTitle(‘User Recertification’);
this.oListItem = list.getItemById(itemid);
oListItem.set_item(‘Accept_x002f_Decline’, ApproveorDecline);
oListItem.update();
clientContext.executeQueryAsync(Function.createDelegate(this, function (sender, args)
{
alert(“Accept/Decline set to ” + ApproveorDecline);
}),
Function.createDelegate(this, OnLoadFailed));
}
}
}
function OnLoadFailed(sender, args) {
//Displays an error in case the request fails
alert(“Request Failed: JSOM Error, ” + args.get_message() + ‘\n’ + args.get_stackTrace());
}

Missing “Save Site as Template” for Publishing Sites in SharePoint 2013?

Summary : Missing “Save Site as Template” for Publishing Sites in SharePoint 2013?, How to Save Publishing Sites as Template in SharePoint 2013,Workaround to Save Site as Template in Publishing Site Template.
One of the old and well known workarounds for this was to directly navigate to “_layouts/savetmpl.aspx” application page and save the site Template. This workaround however does not work as expected in SharePoint 2013 sites.
In a Typical SharePoint 2013 Publishing Site, if you try to navigate to “_layouts/savetmpl.aspx” you would get the below error –
“The “Save site as template” action is not supported on this site.”
SharePoint 2013 Save site as template action is not supported on this site.
The url “_layouts/savetmpl.aspx” failed on the Publishing site because by default, in at Typical Publishing Site in SharePoint 2013, “SaveSiteAsTemplateEnabled” is set as “false”. Setting this switch as true would re-enable us to use “_layouts/savetmpl.aspx” to save a Typical Publishing Site in SharePoint 2013.
The easiest way to set SaveSiteAsTemplateEnabled as true is by using Site options in SharePoint Designer 2013.
Lets look the Steps –
1. Open you Publishing Site in SharePoint Designer 2013.
2. In SharePoint Designer, under Sites tab select “Site Options” (see screen below)
SharePoint 2013 Site Options
3. Find “SaveSiteAsTemplateEnabled” in Site Properties (see below).
SharePoint 2013 Save site as temple
4. Next change this setting to “true”.
SharePoint 2013 Set as True
Apply the Setting once done.
5. Now in your Publishing site navigate to “http://sitename/_layouts/15/savetmpl.aspx” and you would see the old Save Site as Template Page as expected.
SharePoint 2013 Save as Template

How to Save Site as Template in SharePoint 2013

In SharePoint 2013 Sites are Saved as Template in the same way as in earlier versions but there are some steps that you need to consider before moving forward.
Important things to know about Saving Sites as Template –
  • In SharePoint 2013, by default, you Cannot Save a Publishing Site (or a Site with Publishing feature activated) as a Site Template.This however Can be done using a workaround (i.e. using _layouts/savetmpl.aspx url). See this detailed post onHow to Save Publishing Site as Template in SharePoint 2013
  • As in SharePoint 2010 Saving Sites as Template does not generate a .stp file, it gets saved as a .wsp in Solutions gallery.
  • When Saving a Site as Template the WSP generated is temporarily saved in thec:\temp or in c:\windows\tempfolder and later in the solution gallery on SharePoint. Make sure that the App pool account has Full permissions toc:\tempand c:\windows\temp folder.
  • You Cannot Create a Subsite based on a Site Template that was Created in SharePoint 2010. You will need to recreate the site template in the 2013.
So here is the Step-by-Step process to Save a Site as Template in SharePoint 2013.
Steps –
1. Open a Team Site that you need to Save as Template and Navigate to Site Settings ->Under “Site Actions”  select “Save Site as Template”.
If you do not see Save Site as Template and you get “The “Save site as template” action is not supported on this site.” See this post How to Save Publishing Site as Template in SharePoint 2013
2. Next in the Save as Template Page enter Template Name and Description.Click Ok.
3. Next, you would see a Operation Successful message with a link to “solutions gallery”.
4. If you Navigate to the solutions gallery you can see that the CustomTemplate is added to the library.Next we will create a site using this Template.
5. To Create a Site\Subsite from a Template Navigate to “Site Contents” -> new subsite (towards the bottom).


The New “Project Sites” in SharePoint 2013

Summary : The New “Project Sites” in SharePoint 2013,How to Create “Project Sites” in SharePoint 2013,Difference between Project Site and a Team Site.
SharePoint 2013 has new Project Sites Template that provides Out-of-box webparts and pages that facilitate Project Managers and Teams work efficiently. Lets look at the features of this site template.
How to Create a Project Site –  To Create a Project site you can use the Out-of-boxProjects template available. Navigate to Site Contents -> new Subsites and select aProjects template.
Once it gets Created you can see that Projects Sites contain Getting Started tiles, a Project Summary\Timeline webpart,a NewsFeed and a Documents webparts.
Project Sites SharePoint 2013Project Summary or Timeline WebPart – The Timeline WebPart in project sites is tied to “Tasks” list by default but you can edit the properties of this webpart and select any other task list to show even task list in other site or subsite as well.To add tasks to timeline click on Edit the task list and add items to the the Tasks list.
Timeline SharePoint 2013
The Project Summary webpart on the main page gets the Tasks added to it.It also displays the Days left and
Timeline WebPart SharePoint 2013
There is not much difference between a Project Site and a Team Site but here are few minor ones for our readers reference
Project Sites
* Project Sites has “Project Functionality” Site Feature activate by default.
* A Project Summary WebPart is added to the main page by default.
* Project Sites had “Task” list added to it by default.
Team Sites
* Team Sites has “Wiki Page Home Page” Site Feature activate by default. “Project Functionality” Feature is not active by default.
* Project Summary WebPart or any Timeline webpart can be added to the site.
* Team Sites had “Team Task” list added to it by default.