Load scripts in SharePoint within custom Javascript or Workflow

Following is the code which can be used to load JavaScript in sequence.

Source: https://sharepoint.stackexchange.com/questions/92082/uncaught-typeerror-cannot-read-property-get-current-of-undefined

Setting up Node.js & NPM on a machine without administrative privileges and behind a corporate proxy

Recently I was trying to setup a development machine at our office and realized few issues.

  1. The machine didn’t have administrative privileges
  2. It was located behind the corporate proxy

So how to proceed? Following is what I did.

Downloading Node.js & NPM

  1. Download the Node.js binary instead of installer from the below URLs

Node.js binary (32bit or 64 bit): https://nodejs.org/en/download/

  1. Download NPM binary release from the url below

NPM Release: https://github.com/npm/npm/releases

  1. Extract Node.js to D:\Development\Node
  2. Extract NPM to D:\Development\NPM

Set up environment

Every time the development environment is booted do the following

  1. Start a command prompt and set the following path

  1. Check the Node version by typing the following

  1. Check the NPM version by typing the following

If you get version numbers for both then both are working.

  1. Now set proxy so that NPM can download modules by running the following

Now the environment is set up.
Do remember, once the console is closed, all the above settings are lost and needs to be run again, just follow the section “Set up environment” again.

Source URL: http://abdelraoof.com/blog/2014/11/11/install-nodejs-without-admin-rights

Set permissions for a SharePoint list item using 2013 Workflow

Following are the steps to be implemented in a 2013 workflow to set permissions for a SharePoint list item.
This particular method set the permissions for all users in a group with a particular role permission using REST Calls

1. Build Header Dictionary and set to a variable

Name: Accept
Type: String
Value: application/json;odata=verbose

Name: Content-Type
Type: String
Value: application/json;odata=verbose

1. Set “Group ID URL” to a variable

2. Set “Role ID URL” to a variable

3. Set “Break Role Inheritance URL” to a variable

4. Create Response Variables for “Group ID Response”, “Role ID Response”, “Response Headers” & “Response Code” with data type as Dictionary

5. Make GET REST call using Call Action to “Group ID URL” and assign output to above created variables in step 4

6. Use Get Action ‘d/Id’ from above “Group ID Response” variable and set it to a new variable “GroupID”

7. Make GET REST call using Call Action to “Role ID URL” and assign output to above created variables in step 4

8. Use Get Action ‘d/Id’ from above “Role ID Response” variable and set it to a new variable “RoleID”

9. Make POST REST call using Call Action to “Break Role Inheritance URL” and optionally assign output to above created variables in step 4

10. Set “Set Role URL” to a variable

Add Role:

Remove Role:

11. Make POST REST call using Call Action to “Set Role URL” and optionally assign output to above created variables in step 4

Reference URL: https://msdn.microsoft.com/en-us/library/office/dn531432.aspx

Get SharePoint Item’s Author Details using REST

When we fetch document details from the SharePoint, sometimes we may need to get the Author details as well. By default when we do ODATA REST query, we will get only Authorid with a number as a result.

To get Author’s additional details we may need to expand the selected item as show below.

Following list show all the valid Author fields

  1. Title
  2. Name
  3. EMail
  4. MobilePhone
  5. SipAddress
  6. Department
  7. JobTitle
  8. FirstName
  9. LastName
  10. WorkPhone
  11. UserName
  12. Office
  13. ID
  14. Modified
  15. Created

Source: https://social.technet.microsoft.com/wiki/contents/articles/31210.sharepoint-2013-get-user-details-from-person-or-group-field-using-rest-api.aspx

Samsung Pay – It’s easy and fast !

Samsung Pay is now available in India and I am delighted !

Samsung Pay

Pre March 2017…..

In India transactions at shops happen in three ways generally.

  1. Pay in cash
  2. Swipe your debit or credit card and pay
  3. Use digital wallets like Paytm

Issues one might face with cash is, unavailability of proper change or too much of cash in the wallet leading to larger wallets getting either pick pocketed or when most of the people keep it in their back pockets it has impact on your spinal cord.

With debit or credit cards, the magnetic strip wears off after repeated usage or lost. Replacement of cards are generally charged.

Using digital wallets requires an amount to be stored in their account and some times it’s an issue when some out lets don’t support them.


I pay mostly using digital mode until unless the total bill is less than ₹100.00

Following were some of the the issue which I faced.

  1. Wear and tear of debit card or the machine
  2. I leave my wallet at home
  3. QR code at shop is worn off and my banking app doesn’t recognize it

Especially after demonetization resulting in crash crunch, people started to use digital mode of payment more frequently which resulted in POS machines wearing off more frequently.

Post March 2017…..

Samsung launches Samsung Pay in India with almost all the Indian banks being supported.
Initially I was little hesitant, but then decided to try for one particular reason of it being supporting the magnetic readers based machine too as opposed to NFC only. Following is what I did,

  1. Update the Samsung Pay to latest
  2. Register my debit card and agreed for virtual card to be created
  3. Confirm addition of card via OTP

Now my mobile has a digital card added to it’s lock, home screen.

I went out for a purchase and when I was supposed to pay the bill the shop keeper requested me to handover the debit or credit card. I told him I will pay via mobile and he was little confused.

  1. So I got the POS Swipe machine from him
  2. Pressed the power button in my mobile to show the lock screen
  3. Swipe up the Samsung Pay app
  4. Choose the debit card
  5. Keep the mobile near the magnetic reader of the swipe machine
  6. Then payment was same as swiping the card
    1. Enter amount
    2. Enter pin
    3. Payment approved slip being printed out

Samsung Pay Process

It was very easy.

Following are some of the advantages of Samsung Pay

  1. It supports both NFC based and magnetic based readers, hence more POS machines are supported
  2. Samsung’s KNOX (a secure storage space inside mobile) stores the information about the virtual card
  3. I guess Apple supports only NFC and hence less number of POS machines supported
  4. Also Apple and native Android has lower number of banking support in India

The interesting part is people around you are shocked to see such a payment system is available in India !

Copyright note: Image in the article belong to various other websites and copyright resides with them.

Sync desktop files to O365 SharePoint Library

One of the consulting request I got was that an user should be able to sync files from a legacy system to O365 SharePoint Library. The issue was that the legacy system was old and all it could do was place a file in a particular folder.

The solution we could offer was the following.

  1. Configure a Windows mapped drive to point to a SharePoint library
  2. Configure the legacy system to place file into folder

This worked, but having a mapped drive was received as a security threat by the client’s security team.

But now thanks to the newly launched feature of syncing the SharePoint library files with OneDrive, this is easier.
Best part is, it supports both Windows & Mac.
Read more about it here

Sync SharePoint Library with OneDrive Client

Image Source: Office Blog

Copy new appointments from one Outlook calendar to another Outlook calendar using VBA

This post talks about a code which can copy new appointnments and meetings from one Microsoft Outlook calendar to another Microsoft Outlook calendar.
The code is capable of adding new, updating existing and deleting existing items.

One of the issues I was facing while working with my clients was, they had their own email system and they used to send appointment/meeting requests in those accounts for which I had a separate mail ID. For me it was becoming difficult to track all of them. So I was thinking about a way where all the calendar appointments/meetings across multiple clients get added to my own calendar.

While researching on this, came across a superb post Copy New Appointments to Another Calendar using VBA – Slipstick Systems and made use of it.

The code in the post works as is except for 2 things which I have listed below.

  1. The post uses default calendar as source and I wanted multiple calendar. For this instead of using “GetDefaultFolder” I used “GetFolderPath”. Do note that each instance of calendar required specific functions to be repeated. (I am planning to optimise this code so that the functions remain same but we can use multiple folders.)
  2. The post’s delete functionality was not working due to an issue where the delete function was comparing the GUID with starting character as “[“, which I had to comment out.

Following is the final code which worked for me.
Full credit goes to Diane Poremsky

Features not available in SharePoint 2013 Workflow

Following are the features which are not available in SharePoint 2013 Workflow.

  • Actions
    • Stop Workflow
    • Capture a Version of the Document Set
    • Send Document Set to Repository
    • Set Content Approval Status for the Document Set
    • Start Document Set Approval Process
    • Declare Record
    • Set Content Approval Status
    • Undeclare Record
    • Add List Item
    • Inherit List Item Parent Permissions
    • Remove List Item Permissions
    • Replace List Item Permissions
    • Lookup Manager of a User
    • Assign a Form to a Group
    • Assign a To-Do Item
    • Collect Data from a User
    • Start Approval Process
    • Start Custom Task Process
    • Start Feedback Process
    • Copy List Item (SharePoint Designer 2013 supports only the document-copying action.)
  • Conditions
    • If current item field equals value
    • Check list item permission levels
    • Check list item permissions
  • Steps
    • Impersonation Step
  • Data sources
    • User Profile lookup
  • Other features
    • Visio integration
    • Association Column
    • Content Type Association for reusable workflow
    • ‘Require Manage List/Web Permission’ feature for list/site workflow
    • Globally reusable workflow type
    • Workflow visualization option


Source: https://msdn.microsoft.com/en-us/library/jj728659.aspx

File Icons in SharePoint Search Results using Display Template

In SharePoint 2013 search results, the icon for a file type like .msg, .txt shows up as .html icon.
In SharePoint 2010 this was overcome by mapping the icon file type in DocIcon.xml at WFE Servers.

But now since access to WFE servers are restricted in on-prem environment and no access in O-365 environment, the only solution available is to do the following.

  1. Edit the existing display template (I use custom display template with results shown in table and following is based on that) or create a new template for existing for the following located at (SiteCollection/All Files/_catalogs/masterpage/Display Templates/Search) accessible by using SharePoint Designer.
    1. xxxSearchTableResults.html
    2. xxxSearchTableItem.html
  2. Add the following codes and it should show correct icons.

Search Results Display Template:

Search Item Display Template:

ctx.CurrentItem.FileExtension always return the file extension name which seems to match with the file name in the /_layouts/15/images/ folder.

For example msg = icmsg.gif or icmsg.png

Once done, the search results will show-up as following