Wednesday 6 July 2016

How to run Leaderboard meteor example on Windows 10

As I mentioned in my last post that I have started exploring Meteor recently on my very old laptop that I have upgraded to Windows 10. I am going to blog simple to complex issues that I encounters during my exploration phase.

The second hurdle was to run leaderboard example :).

I tried following:

meteor create --example

As I am not using Mac, I received an error message saying that I should use clone git repository using following command. When I try to execute the following command then I received one more error message complaining about that "git" is not recognized as internal or external command.

git clone https://github.com/meteor/leaderboard


So the next thing I did that I downloaded Git for Windows v2.9.0 from

https://git-for-windows.github.io/index.html

Once downloaded and installed then I closed windows command prompt.

After running windows command prompt again and following above commands I was able to run leaderboard successfully :).

Installing Meteor on Windows 10 in 10 minutes :)

Recently I started exploring Meteor. The initial glitch I had on installing it to my Windows 10 machine. Thought of listing following five steps to get it done.


Step 1. Browse to https://www.meteor.com/install

Step 2: Click on "Download Installer" on Windows section.



Step 3: Install and create a developer account (optional).

Step 4: Restart the machine

Step 5: Open a new Command Prompt and type "Meteor"



You are all set up to go ahead. Happy coding :)



Tuesday 19 April 2016

Creating HTML controls in SharePoint List Views and calling JavaScript code from their events!

If you ever need to create some HTML controls in a SharePoint List Views and have to associate some action on some events such as open a dialog form on a click of a HTML Button. 



You can use calculated columns. All you have to do is to define your HTML code in a calculated column and if you are adding some funky logic then add your java script file on the page.

Calculated Column formula: ="<DIV><input type='button' id='clickDetails' value='+'  onclick='javascript:popUp("&IdValue&");'/></DIV>"



Don't forget to change "The data type returned from this formula is:" to either Number, currency etc. If you keep it as "Single line of text" then HTML will render as text not as HTML control.


Where popUp function is defined in the included js file as following. You can include this java script on the page using many methods. For an example you can use a script editor web part to do so.

<script type="text/javascript">
function popUp(Id) {            
    var siteCollUrl = _spPageContextInfo.siteAbsoluteUrl;
    var pageUrl = siteCollUrl + '/SitePages/mypage.aspx?Id=' + Id;
    var options = {
        url: pageUrl,
        args: null,
        showMaximized: false,
        width: 1020,
        height: 750,
        title: 'Collect some data',
        dialogReturnValueCallback: function (dialogResult) {
            SP.UI.ModalDialog.RefreshPage(dialogResult);
        }
    };
    SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
}
</script>

Thursday 25 February 2016

How to create a new Site Collection from an existing one.

Recently I had a requirement to create a exact same copy of one site collection to another new web application.

I used following power shell comdlets to do the job very quickly.

http://xxxx:6203--> This is my root level site collection that I want to copy and spin a new site collection on a new web application.

http://xxxx:43583 --> My New Web application that is just created and no site collection is assigned to it.

Step 1: Create a back up from the source site collection

Backup-SPSite -Identity "http://xxxx:6203" -Path "C:\YS\abc.bak"

Step 2: Create a Web Application

Step 3: Do not create a site collection for new Web Application as we will use our backup to do that.

Step 4: Restore the backup on the new Web Application where http://xxxx:43583 is Web Application url.

Restore-SPSite "http://xxxx:43583" -Path "C:\YS\abc.bak"

Step 5: Verify and test.

Monday 11 January 2016

How to add references for Microsoft.BusinessData.dll and Microsoft.Office.SecureStoreService.dll for a SharePoint 2013 Visual Studio Project

Recently I had issues in adding references for Microsoft.BusinessData and Microsoft.Office.SecureStoreService for a SharePoint 2013 Visual Studio Project. Actually it took me time to find out their locations as one resides in ISAPI folder and other one is in GAC_MSIL. You will not find them by simply going for C:\Windows\Assembly on its default view.

To add them simply using Browse on “Add Reference” dialog on your Visual Studio Project.

Location of Microsoft.BusinessData : C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI


Location of Microsoft.Office.SecureStoreService : C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.Office.SecureStoreService\v4.0_15.0.0.0__71e9bce111e9429c