Jul 19, 2017

Largest FREE Microsoft eBook Giveaway

Hi Readers,
I am going to share a link for the LARGEST FREE MICROSOFT eBook Giveaway by Eric Ligman (just incase, if you are not aware of)
Topics include
Windows 10      
Office 365
Office 2016
Power BI
Azure
Windows 8.1
Office 2013
SharePoint 2016
SharePoint 2013                                       
Dynamics CRM
PowerShell
Exchange Server                                                     
System Center
Cloud
SQL Server and more!

Largest FREE Microsoft eBook Giveaway 

Share it with your friends through social tags!! It could help someone.

Jul 7, 2017

Multi value Lookup Columns in SharePoint

I couldn't find anything obvious for accessing SharePoint Multi-value lookup columns and filtering the values so chucked this together, hopefully useful for someone๐Ÿ˜ƒ
In continuation to my previous article on Lookup Columns, we are going to learn about Multi-value lookup columns in SharePoint.
At the end of this article, I am going to give a bonus to the readers of this article ๐Ÿ˜Š
Let's go ahead and create two source lists for this demo:
1. States 
2. Cities (State is a lookup column from States list)
3. The third list will be used to implement the Multi-value lookup column and also we are going to implement filtering multi-value lookup columns in this article. I have created a list named "Multi value lookup demo" which has State and City as lookup value from the first two lists created. Make sure, you select Allow multiple values options as shown below:

The new item form without filtering looks as shown below:
Following are the functionalities to be implemented & issues/challenges needs to be considered while implementing filtering multi-value lookup columns in SharePoint:
1. An option can be double clicked to select or clicked Add button to select a value
2. An option can be double clicked to deselect or clicked Remove button to deselect a value
3. More than one option can be selected and can be bulk added to the selected values
4. The JQuery implemented should satisfy the above conditions while filtering
5. When State is selected, the values of Cities should get filtered. In the same way, when a value from the deselected then the values from Cities should be removed
I have added a Script Editor web part in New item form and added JQuery as reference. Also, added the JS code which will implement the filtering functionality.
If you want to implement the same functionality in Edit item form, following the same steps just mentioned above.
I have used CAML query to do the filtering functionality which is shown below:
$(document).ready(function () {
    //Call multi-value lookup function on selecting State
    $("select[title='State possible values']").dblclick(function () {
        multiValueLookup();
    });
    //Call multi-value lookup function on removing State
    $("select[title='State selected values']").dblclick(function () {
        multiValueLookup();
    });
    //Call multi-value lookup function on clicking Add - State
    $("input[value='Add >'][id^='State_']").click(function (){
        multiValueLookup();
    });
    //Call multi-value lookup function on clicking Remove - State
    $("input[value='< Remove'][id^='State_']").click(function () {
        multiValueLookup();
    });
});
function multiValueLookup() {
    var items = "";
    var citiesListName = "Cities";
    $("select[title='City possible values'] option").remove();
    $("select[title='State selected values'] option").each(function (i) {
        var clientContext = new SP.ClientContext.get_current();
        var oList = clientContext.get_web().get_lists().getByTitle(citiesListName);
        var camlQuery = new SP.CamlQuery();
        camlQuery.set_viewXml("<View><Query><OrderBy><FieldRef Name='Title' /></OrderBy><Where><Eq><FieldRef Name='State' LookupId='TRUE'/><Value Type='Lookup'>" + $(this).val() + "</Value></Eq></Where></Query></View>");
        var items = oList.getItems(camlQuery);
        clientContext.load(items);
        clientContext.executeQueryAsync(success, failure);
        function success() {
            var pn2 = "";
            var pn1 = "";
            var ListEnumerator = items.getEnumerator();
            while (ListEnumerator.moveNext()) {
                var currentItem = ListEnumerator.get_current();
                if (currentItem.get_item('Title') != null) {
                    var pn1 = currentItem.get_item('Title');
                    if (pn2 != pn1) {
                        items = "<option value='" + currentItem.get_item('ID') + "' title='" + pn1 + "'>" + pn1 + "</option>";
                        $("select[title='City possible values']").append(items);
                        pn2 = pn1;
                    }
                }
            }
        }
        function failure(sender, args) {
            // alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
        }
    });
}

The above code is self explanatory and I have added few screenshots below for reference:
When an value is selected
When an value is deselected
The added value in the multi-value lookup demo list
Cool isn't it? ๐Ÿ˜Š Very simple as well.
If you have read my previous article on Cascading Lookup Columns in SharePoint, you would have noticed that I have implemented the functionality using REST API.
You may think why I didn't implement multi-value lookup column using REST API? so the bonus is here. I have implemented the above functionality using REST API as well. I will add the code in download link and you can follow either of the way to implement this functionality ๐Ÿ˜Ž
This is tested in SharePoint Online and I am sure it should work for SharePoint 2013, 2016 & 2010 as well.
To download, lists templates, JS code using CAML, JS code using REST API, click this link. ๐Ÿ”—
Please free to comment. Always, your comments help me to write more.๐Ÿ˜ƒ Share this post to others if this helps you!๐Ÿ˜‡

Jun 28, 2017

Cascading drop down in SharePoint using REST API

Cascading drop down or filtered Lookup Columns in SharePoint is one of the most used functionality in most of the projects for various business needs.
In one of my old articles, I have explained about creating cascading or filtered lookup columns using JQuery & SPServices in MOSS 2007 version of SharePoint. 
This solution has limitations such as this will work only in List Forms and it may not work after certain limit of values in the drop down.
Previous articles reference 
CAML Query tutorial for SharePoint
Multi value Lookup Columns in SharePoint
In this article, we will learn to implement Cascading or Filtered Lookup Columns in latest versions of SharePoint using REST API (applicable to SharePoint 2013, Office 365 – SharePoint Online, SharePoint 2016). REST API uses OData (Open Data Protocol) services to read/write/update data in SharePoint.
I have created 2 lists with the following information as shown below:
  1. Drinks 
  2. Drinks Type (Drink column is a lookup column to display Title from Drinks List)             
             
Now create a list to test the cascading or filtered lookup functionality. I have created a list with “Drinks Menu” as the name. 
             
Please note, the Drinks and Drink Type columns are created as Choice type and all the values from Drinks and Drink Type are added as choices in these fields. This is implemented in this way so that we can avoid the issue surfaces when we have large number of options in Lookup Column. 
Also, if you add a new value to parent lists (Drink or Drink Type lists in this scenario), add the values as choice in the cascading lookup value implementation list ( Drink Menu list in this scenario).
Now, click on the new item which will open the “NewForm.aspx” -> Edit the page -> Add a Web Part -> Insert -> Categories -> Media and Content -> Script Editor -> Click Add to add it.
In the Script Editor, click Edit Snippet and add the CascadingDropdown.js (download from the below attachment). I have referred “JQuery.1.12.0.min.js” in the code which is also available for download. Make sure JQuery is referenced properly in your code else, the script won’t work.
Following are the scenarios, I have covered in this example:
When “Drinks” drop down is not selected or changed to empty, then “Drink Type” & “Price” fields should be disabled and empty

When “Drinks” is selected, “Drink Type” should cascade (filter the values) and show the types based upon selection
When “Drink Type” is selected, the “Price” should automatically populate in the Price field
The data saved to the list will look as shown below:
JS code for cascading the lookup values (Drinks -> Drink Type) is shown below:
//Function to filter the values of Drink Types
function loadDrinkTypes(selectedDrink) {
    var drinkTypeListName = "Drink Type";
    var drinkTypeListURL = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('" + drinkTypeListName + "')/items?$select=Title,Drink/Title,Drink/Id&$expand=Drink&$filter=Drink/Title eq '" + selectedDrink + "'";
    getReqData(drinkTypeListURL, function (data) {
        var items = data.d.results;
        if (items.length > 0) {
            var optionsAsString = '<option value=""></option>';
            for (var i = 0; i < items.length; i++) {
                optionsAsString += "<option value='" + items[i].Title + "'>" + items[i].Title + "</option>";
            }
            $('select[title="Drink Type"]').html(optionsAsString);
        }
    },
        function (data) {
            //alert("Some error occurred in getting Drink Types");
        });
}

//JQuery AJAX to access REST API JSON data
function getReqData(reqUrl, success, failure) {
    $.ajax({
        url: reqUrl,
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        success: function (data) {
            success(data);
        },
        error: function (data) {
            failure(data);
        }
    });
}
JS code for setting the Price value automatically on Drink Type selection is shown below:
//Function set the Drink Price 
function setDrinkPrice(drinks, drinkType) {
    var drinkTypeListName = "Drink Type";
    var drinkTypeListURL = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('" + drinkTypeListName + "')/items?$select=Price&$filter=(Drink/Title eq '" + drinks + "') and (Title eq '" + drinkType + "')";
    getReqData(drinkTypeListURL, function (data) {
        var items = data.d.results;
        if (items.length > 0) {
            var price = "";
            for (var i = 0; i < items.length; i++) {
               $("input[title='Price']").val(items[i].Price);
            }
        }
    },
        function (data) {
            //alert("Some error occurred in getting price");
        });
}
Please download the full code to view how each method are called in document.ready()
Note:
1. The above code is tested in SharePoint Online (all the lists are in Classic Mode and not Modern List views in SP Online)
2. It should work in SharePoint 2013 and 2016 versions as well
Please free to comment. Always, your comments help me to write more.๐Ÿ˜ƒ Share this post to others if this helps you!๐Ÿ˜‡
You’re still here? I don’t have anything else for you sorry. It’s straightforward. Go… go make some users happy. ๐Ÿ˜Ž๐Ÿ˜€
Update: 06/07/2017
To know about implementing multi-value lookup column and filtering values, read this article: Multi value Lookup Columns in SharePoint

Jun 20, 2017

Accessing Checkbox in SharePoint using JQuery

I couldn't find anything obvious for accessing SharePoint Check Box so chucked this together, hopefully useful for someone else ๐Ÿ˜‰๐Ÿ˜Ž
Note: The below code/solution is applicable to accessing check box in a custom SharePoint List forms using SharePoint Designer. To know how to create a custom form in SharePoint Online, read this article Get Current Logged in User & Manager using REST API in SharePoint OnlineAccessing Check Box control in SharePoint is little tricky than accessing the check box in HTML. The reason being, Check Box control is rendered as a table instead of a single control as shown below (Check Box and its preview in developer tools - Chrome):
So, each check box is rendered inside SPAN tag in a table. To access the normal SharePoint controls, we will use either ID or title property but for Check Box it is little complicated.
The actual check box control is in "input" tag 2. The values (Example here: A, B) are inside "label" tag 3. But each control (Yes & No) are represented by ID which is generated by SharePoint 4. If you look at the ID, there is "ff5" which is the ID of the control generated randomly by SharePoint
Now, open the designer, add an ID to the TD of the Check Box so that we can query it easily using JSOM as shown below:
//Get the checked values of Check Box
$("input[id ^= 'tdLanguage']").is(function(){
    var checked = $(this).is(":checked"); //is checkbox checked (true/false)?
    var theVal = $(this).next().text();  //get the label for this checkbox
    alert(checked + " : " + theVal);
});
//Check if checkbox is selected or not
($("#tdLanguage").children().find('input:checkbox').is(':checked'))
//Check box checked or not - single check box type in SharePoint
$("td[id='tdLanguage'] input:checkbox[name*='ff5']").is(":checked")
//Check all the values of checkbox
$("td[id='tdLanguage'] input:checkbox[name*='ff5']").attr('checked',true )
//Uncheck /Clear all checkbox values
$("td[id='tdLanguage'] input:checkbox[name*='ff5']").attr('checked',false )
*** "'tdLanguage'" is the ID of the SharePoint Radio Button Control, "ff5" is the unique ID of the SharePoint Control in your List form. Change this ID according to your form to get the exact result.
Please share your valuable comments which will make me write more and also share this post using the below social buttons to others.
Happy Share(ing)Point! ๐Ÿ‘

Jun 2, 2017

SharePoint Online Software Boundaries and Limits


Size limit and Number of items that can be synced
1.     You can sync up to 20,000 items in your One Drive for Business library. This includes folders and files.
2.   You can sync up to 5,000 items in a SharePoint library. This includes folders and files. These are the libraries that you find on various SharePoint sites, such as team sites and community sites. This also includes syncing other people's One Drive personal sites that you may have access to. You can sync multiple SharePoint libraries.
3.     In any SharePoint library, you can sync files of up to 2 GB
Character limit for files and folders
  1. In SharePoint Online, file names can have up to 256 characters
  2. Folder names can have up to 250 characters
  3. When you sync One Drive for Business with SharePoint Online, a folder named "forms" isn't supported at the root level for a list or library. This occurs because "forms" is a hidden default folder that's used to store templates and forms for the library.
  4. Any file that’s currently open by an application (for example, an Excel .xlsx file) can't be synced by One Drive for Business.
  5. To sync the file, close any application where the file is currently being used, and then sync the file.
  6. The following characters in file names aren't supported when you sync One Drive for Business with SharePoint Online: (\, /, :, *, ?, “, <, >, |, #, %, ~)
SharePoint Online Site Collection
1. SharePoint Online Site collection package details below:
  • Small Business: a single Team Site Collection
  • Midsize Business plans: limits 20 Team Site Collections
  • Enterprise, Education, and Government: limits to 10,000 Team Site Collections
2. In all options, just single Public Web Site Collection can be created, 1TB for My sites, 2000 site/sub site per site collection
Developer Limits
Only Sandbox Solutions are designed to allow SharePoint developer to customize/develop on Office365/SharePoint Online
  • No access to file/folder. It means you cannot use IO API commands
  • Only be deployed at a site collection level scope (not farm scope)
  • No access to web.config
  • PDF Documents cannot be opened in the browser
  • Restrictions to access security
  • Cannot overuse system resources
Storage
The following table describes the limits for SharePoint Online in Office 365 Business Essentials and Office 365 Business Premium:
Feature
Description
Storage per user (contributes to total storage base of tenant)
500 megabytes (MB) per subscribed user
Storage base per tenant
10 GB + 500 MB per subscribed user + additional storage purchased
For example, if you have 10,000 users, the base storage allocation is approximately 5 TB (10 GB + 500 MB * 10,000 users)
You can purchase an unlimited amount of additional storage
Site collection storage limit
Up to 1 TB per site collection. (25 GB for trial).
SharePoint admins can set storage limits for site collections and sites. The minimum storage allocation per site collection is 100 MB
List view threshold limit in site libraries, including files and folders
You can sync up to 5,000 items in site libraries, including folders and files
Site collections (#) per tenant
500,000 site collections (other than personal sites)
Sub sites
Up to 2,000 sub sites per site collection
File upload limit
2 GB per file
Number of external user’s invitees
There is no limit to number of external users you can invite to your SharePoint Online Site Collections

May 18, 2017

Site Mailbox is removed from SharePoint Online


I tried to create a Site Mailbox this morning, in SharePoint Online and came to know this feature is no longer supported in SharePoint Online.
 

Tried to understand it in detail and following are the updates:
  1. Microsoft is notifying Office 365 customers that access to Site Mailboxes is being removed from SharePoint Online, and no more Site Mailboxes can be created from March 2017 onward.
  2. Site Mailboxes originally appeared as a feature of Exchange Server 2013. Site Mailboxes appended together an Exchange mailbox with a SharePoint site to allow users to collect email conversations in a single location, as well as access shared documents from both Outlook and SharePoint.
  3. If you are using Site Mailboxes, then you have got some migration work to look forward to. Otherwise, if you are looking for “email-centric collaboration”, Office 365 Groups are the way to go (Reference: Microsoft Community Groups).

May 5, 2017

Slide Library in SharePoint Online

When you try to migrate from SharePoint 2010 to SharePoint Online (Office 365), Slide Library template is not listed as app in the Create App section.
You can still get it with a direct URL. I would not depend on it being there forever as the Slide Library is officially not in SharePoint 2013, but for now you can create one.
The direct URL to create the old Slide Library:
http://yourserver/sites/yoursite/_layouts/15/slnew.aspx?FeatureId={0be49fe9-9bc9-409d-abf9-702753bd878d}&ListTemplate=2100


Update 22/05/2017:
Even though above solution works as expected in SharePoint 2013 & SP Online it is advisable not to use since Microsoft may remove this feature in future.

Feb 28, 2017

Challenges to be considered before migrating from SharePoint 2010 to 2016

  1. Identifying the business owners for each site / site collection
  2. Data Cleansing - identifying the old contents/obsolete data for archiving
  3. Identifying the intranet links embedded inside the documents (while migrating to SharePoint Online) 
  4. Optimize and define databases - Perform re-organization of content. For example, as you determine what will be brought over to the new environment, you may end up archiving some ‘less-used’ content to a ‘read-only’ or ‘slower’ server.Consider moving read only data to a separate SQL instance or even separate SQL farm where the data is read-only. You may also want to consider moving less frequently used content to SQL servers that have less resources and keep the higher performing SQL servers for the frequently used/collaborative content, perhaps your ‘old’ SQL server.
  5. Size of data to be migrated – this will affect the migration time
  6. Any good migration should involve a content audit. Data security (legal & audit implications should be considered) –confidential documents which are restricted for internal use cannot be migrated to SharePoint Online. Key ‘things’ like ‘Highly Visible or Critical Areas’, ‘Executive Users Permissions’, ‘Large AD Group Users’ assignments, ‘Highly Used’ Features, ‘Heavy Customizations’, Integration with other systems, etc. must be identified, and documented in order to identify where the critical data and functionality exists. Depending on the access to the content, an appropriate ‘services’ and ‘security’ model can be included in the SharePoint migration planning (and later validation).
  7. SharePoint 2010 cannot be directly migrated to 2016 and it needs to be migrated to 2013 and then to 2016 version (when Database upgrade approach is opted as an option for migration)
  8. If tool based migration (like Sharegate, Metalogix) approach is used, then direct migration from 2010 to 2016 is possible
  9. 10 GB is the new soft limit for file sizes in SharePoint 2016
  10. If custom master page is used, then the existing master page needs to be upgraded /recreated from 2010 -2013 –then 2016 version for using it in SharePoint 2016
  11. While using database upgrade (2010 to 2013 and then to 2016) approach, SharePoint 2010 sites will be made read only during migration process
  12. Any custom farm solutions should be upgraded to SharePoint 2016 before use
  13. The same connectivity/integrations to external systems in SharePoint on-premises environment may not be achieved in SharePoint Online
  14. New user ID’s needs to be created in SharePoint Online. New/ existing permission levels needs to be created in SharePoint Online
  15. End users needs to be trained for new UI/navigation, etc.

Jan 18, 2017

Enable "Open with Explorer" Option In SharePoint Online Document Libraries In Microsoft Edge Browser

Happy New Year 2017 to all readers and wish you all success in this year ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ

I was asked by my colleague who is from different Technology stream about “Open with Explorer” option disabled in SharePoint Online document libraries in Microsoft Edge browser.
Microsoft Edge browser has a new look and feel than other IE versions and obviously it is going to take a while for all end users to get used to / to know the various options in it.I tried checking the permissions of the user and he has admin permissions but still the user couldn’t open the library with explorer option as shown below:
As usual searched for various articles and understood about the features of Microsoft Edge browser.Read this KB article about Microsoft Edge and SharePoint behavior:

Solution:
Navigate to the edge browser -> click on Open with Internet Explorer as shown below:

Now, the SharePoint site should open in the IE 11 (latest version before Microsoft Edge is released).As expected, in IE 11, Open with Explorer option is enabled and everything works perfectly as shown below:
If you want to sync, click on Sync and it will open the One Drive -> Sign in -> Sync the data.

Hope this helps you!
Please share your valuable comments which will help me write more and share this post using the social buttons below.

Dec 13, 2016

Character Limit using JQuery in SharePoint

In this post, we will learn how to implement Character Count (here in this example, maximum allowed 2000 characters) using JQuery in SharePoint.

Prerequisite:
1. Create a SharePoint List with a column named "Comments" - data type Multi line text with plain text as the option selected
2. SharePoint Designer 2013 for editing the SharePoint list with span and to identify the ID of the field created

Solution:
1. Open the SP site in SharePoint designer, navigate to the list -> Create a custom new form -> Edit it.
To know how to create a custom new form in SharePoint Designer, read this article.
2. Below is the HTML code for my "Comments field in SharePoint Designer:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
<tr>
    <td width="190px" valign="top" class="ms-formlabel">
        <H3 class="ms-standardheader">
   <nobr>Enter your comment:</nobr>
  </H3>
    </td>
    <td valign="top" class="ms-formbody" style="background-color:#ffffff; width:400px;">
        <SharePoint:FormField runat="server" id="ff6{$Pos}" ControlMode="New" FieldName="Comments" __designer:bind="{ddwrt:DataBind('i',concat('ff6',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Comments')}" />
        <SharePoint:FieldDescription runat="server" id="ff6description{$Pos}" FieldName="Comments" ControlMode="New" />
        <span title="2000" id="commentsCount">2000</span><span> Characters Left</span>
    </td>
</tr>
Make a note that I have added a Span tag below the SharePoint control to display the Characters. Also, we have declared it as 2000 characters for this example.
Now, add a script tag or a separate file (then refer it inline) -> add the below code in it save it:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
$(document).ready(function() {
 //Character count for comments text
 $("textarea[name*='ff6']").keyup(function () {
  characterCount('ff6', '#commentsCount');
 });
});

//Character count for multiline text 
function characterCount(controlID,spanId)
{
  var controlVal = $("textarea[name*='" + controlID + "']");
  var cmax = $(spanId).attr("title");
  if(controlVal.val().length >= cmax) {
      controlVal.val(controlVal.val().substr(0, cmax));
   }
  $(spanId).text(cmax - controlVal.val().length);            
}
In this above JS, "ff6" is the ID of the SharePoint control.
Save the form and JS, try typing inside the control you can see the characters been automatically counted and decreases as you type. Cool Isn't it? ๐Ÿ˜‰
Please share this post by clicking the below social buttons if this helps you๐Ÿ˜Ž
Happy coding!