Pages

Thursday, December 24, 2015

SP.Core.js file was not initialized during page post back in SharePoint 2013

Problem

Today we had an issue where the sp.core.js file was not initialized after the post back of a application page. So the other SharePoint JavaScript files like sp.js, sp.runtime.js threw errors (As in the screenshot below). So, the functionalities didn’t work as expected.

Capture

Environment

The sp.core.js file was referenced in the master page and our custom JavaScript file (the file where our functionalities are implemented. We were opening a modal pop up implementing some logics) was referenced in the aspx page. Our client wanted us to work only in the custom JavaScript file and not in the master page or in application page.

Solution 

We used registerSod function which is available in SharePoint Script On Demand (SP.SOD) framework in order to load build in SharePoint JavaScript libraries.
 
  1. /* SP.SOD.registerSod(key value (any unique string), path of the script file); --- */
  2. SP.SOD.registerSod('sp.core.js', '\\_layouts\\sp.core.js');
  3. /*  executeFunc is used to execute the file mentioned above. using dummy function --- */
  4. SP.SOD.executeFunc('sp.core.js', false, function () { });
  5. SP.SOD.registerSod('sp.js', '\\_layouts\\sp.js');
  6. SP.SOD.executeFunc('sp.js', false, function () { });
  7. SP.SOD.registerSod('sp.ui.dialog.js', '\\_layouts\\sp.ui.dialog.js');
  8. SP.SOD.executeFunc('sp.ui.dialog.js', false, function () { });

Reference

http://www.vlieshout.net/sharepoint-2013-lazy-loading-javascript/






Wednesday, December 23, 2015

Remote debug SharePoint Provider hosted add-in deployed in Azure

Steps

  1. Deploy your provider hosted add-in to azure website with the configuration setting as “Debug”. debug1
  2. On Visual Studio (My version is 2013) go to server explorer and sign into your azure subscription. imageimage
  3. Once you are success all your azure services will be listed. image
  4. Now right click on your azure website where the provider hosted app is deployed and click in the Attach debugger.  image 
  5. Now you can debug your provider hosted app
image

Wednesday, October 14, 2015

Microsoft SharePoint Server 2016 IT Preview is available in Azure Platform Gallery

SharePoint Server 2016 IT preview is available in Azure Platform which installs binaries in Windows Server 2012 R2 Datacenter. Here are the screenshots on creating virtual machine with SharePoint 2016 IT preview binaries. Once you create the VM you need to run the configuration wizard and follow the steps as here.

001

 

002

 

003

 

004

Wednesday, August 26, 2015

Installing SharePoint Server 2016 IT Preview

Introduction

After the announcement of SharePoint Server 2016 IT Preview, I tried to install a standalone SharePoint server. So here are the steps to install SharePoint 2016 IT Preview. 

 

Installing SharePoint 2016 Prerequisites

Step 01.
I created a azure virtual machine with Microsoft Windows Server 2012 R2.

Step 02
Installed MS SQL Server 2014

Step 03
Download and extract the ISO file using win rar.

Step 04
Double click on prerequisiteinstaller fle. You will get the below screen which asks to install SharePoint 2016 prerequisites. 

image

Step 05
Click Next

Step 06
Then License Terms and conditions screen will be displayed.


image
Check the accept the terms check box and click next.
Once you click “Next” button the prerequisites will start installing.
image
Once the prerequisites installed successfully; If you prompt to restart your server.
Click finish and restart your server.
image

Install SharePoint Binaries

Step 01
Double click the setup file.
You will be asked to enter the product key. You may give the below trail key if you don’t have any: NQTMW-K63MQ-39G6H-B2CH9-FRDWJ

image

Click Continue.

Step 02
You will asked to accept agreement. Check the check box and click Continue again.

image

Step 03
image
If you want to select different locations for SharePoint binaries and Data you can select the location by clicking browse.
I’m not changing anything here. Click “Install Now” to continue.
image
Once I click “Install Now” the installation starts.

Step 04
Now we will get the screen for running the configuration wizard.
image
I will check the check box and click close, So that the binaries are installed successfully and the configuration wizard will start running.

Running the configuration wizard

Step 01
Below is the first screen. Click Next

image
image
Click Yes
Step 02
image
The next screen will be as above. Since this is new server farm, I will select the second option and click next.
Step 03
The next screen is to give database server and database name. You have to give your server name where you had installed MS SQL Server.
image
Step 03
Then you have to give the unique passphrase. Type a passphrase which you can remember. Then click next.
image
Step 04
Next one is very important screen where we have to select the server role. Since my environment is a Single server farm I will select the last option. 

image
Click Next

Step 05
The next screen to enter the central administrator port number and to select the authentication type.
image

Next Screen will be the summery
image
Click Next and the configuration wizard will start running.
image
Once the setup is success, we will get the below screen.
image
Click Finish.
Once you click finish your browser will open and your central administrator will be loaded.
 image










Now you can play around your SharePoint 2016.

Tuesday, August 25, 2015

SharePoint 2016 Software Prerequisites | SharePoint Server 2016 IT Preview

 

Introduction

After the announcement of the availability of SharePoint Server 2016 IT Preview yesterday (24th August 2016) I downloaded the setup and tried to install, to see what the software prerequisites; which I got the below screen where it lists the software prerequisites.

image

 

Software Prerequisites

• Application Server Role, Web Server (IIS) Role
• Microsoft SQL Server 2012 Native Client
• Microsoft ODBC Driver 11 for SQL Server
• Microsoft Sync Framework Runtime v1.0 SP1 (x64)
• Windows Server AppFabric
• Microsoft Identity Extensions
• Microsoft Information Protection and Control Client 2.1
• Microsoft WCF Data Services 5.6
• Microsoft .NET Framework 4.5.2
• Cumulative Update Package 1 for Microsoft AppFabric 1.1 for Windows Server (KB2671763)
• Visual C++ Redistributable Package for Visual Studio 2013
• Update for Microsoft .NET Framework to disable RC4 in Transport Layer Security (KB2898850)

Await for updates on SharePoint 2016 IT preview.

Tuesday, July 7, 2015

Failed to create the configuration database. System.ServiceProcess.TimeoutException was thrown in SharePoint 2013

Problem

I was installing SharePoint 2013 SP 01 in a client’s machine and I got System.ServiceProcess.TimeoutException exception thrown when the configuration wizard trying to creating the configuration database. The screenshot attached below.

21

When I noticed in services the “SharePoint Tracing Service (SPTraceV4)” being stuck on stopping state.

Solution

Step 01. Right click on services and open the properties
Step 02. Changed the Recovery as shown below. 

689550
Step 03. Kill the wsstracing.exe (This is the name of the windows service for SharePoint tracing service) using task manager.

Conclusion

When I killed the process the process started automatically and as the same other process also started as needed.
The installation was a success.
Please check the below link for the conversation regarding tis post which took place in msdn.
https://social.technet.microsoft.com/Forums/office/en-US/fe3572a1-af49-493b-af5b-f1de0ab5ea4c/sharepoint-tracing-service-sptracev4-stuck-on-stopping-when-installing-sharepoint-2013?forum=sharepointadmin#04678991-a3fd-45d6-8102-16eedf5d7c37

Tuesday, June 9, 2015

How to get SharePoint User by User Id in JavaScript using JSOM

Solution

  1. function getUserById() {
  2.  
  3.     var context = new SP.ClientContext.get_current();
  4.     var user = context.get_web().get_siteUsers().getById('1073741823');//Give the user id here
  5.     context.load(user);
  6.     context.executeQueryAsync(
  7.          Function.createDelegate(null, ensureUserSuccess),
  8.          Function.createDelegate(null, onFail)
  9.     );
  10.  
  11.     function ensureUserSuccess() {
  12.         //You can access the properties here
  13.         alert(user.get_title());
  14.         alert(user.get_loginName());
  15.     }
  16.  
  17.     function onFail() {
  18.         alert('Fail');
  19.     }
  20. }

Thursday, May 14, 2015

Web Designer Galleries section is missing on SharePoint Online

Problem

Recently I had to create a trial Office 365 account for a demo purposes. But there are some sections such as “Web Designer Galleries”, “HTML Field Security”, “SharePoint Designer Settings” (under Site Collection Administration section) were missing on the setting page of the SharePoint site.

Also I was not able to upload JavaScript file in my document libraries. 

So here are the steps for resolving the issue.

Solutions

Method 01

Step 01: Go to Admin panel

image

Step 02: Go to SharePoint admin center by selecting SharePoint from the left navigation

 001Step 03:  There go to the setting page

002Step 04: From there allow Custom Script

image

There is a  note saying “changes to this setting might take up to 24 hours to take effect.” So here is the power shell command to do that for immediate effect.

Method 02

Step 01: Open the SharePoint Management shell

Step 02: Type the below command to connect with SharePoint Admin Center in management shell. You have to replace your admin center url which is in line 1.

  1. $spadminurl = "https://suhailj-admin.sharepoint.com/"
  2. connect-sposervice -url $spadminurl

Step 03: You will be asked to enter user name and password.

image

Step 04: Enter the below commands. You have to mention your site collection url where you need the sections.

  1. $spsiteurl = "https://suhailj.sharepoint.com"
  2. Set-SPOsite $spsiteurl -DenyAddAndCustomizePages 0

 

Conclusion

Immediately you can see the web designer galleries in setting page; and I was able to upload JavaScript files in my document libraries.

image

Sunday, May 3, 2015

Happy to share my knowledge with A/L students

Happy that I was able to share my knowledge on Database Normalization with current A/L students from Maruthamunai. The seminar was organized by Kalmunai IT Hub and Maruthamunai Online. 


AL2015 (1)AL2015 (2)AL2015 (3)

Tuesday, April 7, 2015

Retrieve form urls in JSLink (NewForm.aspx | DispForm.aspx | EditForm.aspx) in SharePoint Online and in SharePoint 2013

 

Problem

I had a requirement to add a link tag where the url redirects to Display form of a item. I was rendering the view using JSLink.

Read my previous posts on JSLink on http://jsuhail.blogspot.com/search/label/JSLink

Solution

Display Form Url

var url = String.format('{0}&ID={1}', ctx.displayFormUrl, ctx.CurrentItem.ID);

Edit Form Url

  1. var url = String.format('{0}&ID={1}', ctx.editFormUrl, ctx.CurrentItem.ID);

New Form Url

ctx.newFormUrl