Skip to main content


Showing posts from 2017

How to upload file to FTP server using C# Asp.Net #RathrolaPremKumar

This post is about uploading files to FTP server in development. You will learn step-by-step to upload files programmatically to FTP web server. All the examples shared in this post are intended by professionals to make you learn about the subject
Here, I will explain you an example of Uploading Files to FTP Server programmatically in C#.Net. Using this approach, the Files will be pro grammatically uploaded to FTP Web Server. For example, I will create a function in which we will simply provide the local file name to upload, upload path of FTP (including host name, FTP username and FTP password). This function uses System.Net and System.IO namespaces to upload the file.
Let’s create a simple console Application to give you example of Uploading Files to FTP Server. So, a new console application will be something like this,

Now, add references of the System.Configuration Assembly to the project in the following way. 1.Right click on the project and click Add Reference option from the…

How to Export SharePointList to Excel Using C# Programatically 2017 #RathrolaPremKumar

Hi All,
 Today I will give you the code for exporting data from SharePoint List to Excel.

Ok Without delay, directly going to the code...


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using System.Data;
using System.IO;
using System.Web.UI;

namespace Excel
    class Program
        private static DataTable dataTable;
        private static SPList list;

        static void Main(string[] args)
                SPSite Osite = new SPSite("http://PremKT/sites/Testing/Creative%20CR%20Tracker");
                SPWeb oWeb = Osite.OpenWeb();
                string _siteUrl = oWeb.Url.ToString();
                if (!string.IsNullOrEmpty(_siteUrl))
                        using (SPSite site = new SPSite(oWeb.Url))

The list is too large to save as a template. The size of a template cannot exceed 10485760 bytes in SharePoint

In SharePoint 2013: By default it is 50MB in SharePoint 2010 or SharePoint 2013. So if it increased the limit then it will give an error like below,

ou can also use PowerShell command to increase the limit like below:
Add-PSSnapinMicrosoft.SharePoint.Powershell $webservice=[Microsoft.SharePoint.Administration.SPWebService]::ContentService Write-Host"Size: "$webservice.MaxTemplateDocumentSize $webservice.MaxTemplateDocumentSize =262144000#250 MB $webservice.Update() 
Hope this will be helpful.

SharePoint Config Increasing the maximum size of list templates #RathrolaPremKumar

Saving a list as a template is an easy way of transferring data from one place to another in SharePoint. By default, however, the maximum size of list templates in WSS 3.0 and MOSS 2007 is 10MB.

If you try to save the list as a template that is larger than this you will get the following error:

The list is too large to save as a template. The size of a template cannot exceed 10485760 bytes.

To increase the maximum size, simply run the following stsadm command (from the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN directory) replacing the propertyvalue to the new maximum size (in bytes):

stsadm -o setproperty -propertyname max-template-document-size -propertyvalue 50000000

Points to note:

The propertyvalue parameter is in bytes, so the example above will increase the maximum size to approx 50MB.
There is a hard limit of 500MB so the value must be less than 524288000 or you will get an error when saving the list as a template.
The above increases the maxim…

'#Resolve' To export a list, you must have a Microsoft SharePoint Foundation-compatible application.

Searching this error message easily finds the root of the problem. There is a problem with the Office 64 bit version. It doesn’t work with SharePoint. These solutions generally tell you to uninstall your 64 bit office and install a 32 bit version. Happily there is a much easier solution.
Despite the error message the export actually works! Notice the yellow bar at the bottom of your browser. Simply save the .iqy file normally and open it with Excel. It’s that simple. The error message is certainly a nuisance but does not actually stop the export.
Thanks for ready my blog :)

Resolve Class not registered exception - SharePoint 2013 By #RathrolaPremKumar

Hi All,

We got below error when trying to use SPSecurity.RunWithElevatedPrivileges in console application

Retrieving the COM class factory for component with CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

using Microsoft.SharePoint;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SampleComnsoleApp
    class Program

        static void Main(string[] args)
            bool quiet = false;
                (new Program()).Run(quiet);
        private void Run(bool quiet)



The console application is running under 32 bit processor. Just change it to 64 bit.
To do this:

Right click on Console Application
Select Properties 
Under Build Tab, change Platform Targ…

MVC Interview Questions for Experience Candidates #JustSharing

What is MVC (Model view controller)?
Explain MVC application life cycle?
Is MVC suitable for both Windows and web applications?
What are the benefits of using MVC?
Is MVC different from a three layered architecture?
What is the latest version of MVC?
What is the difference between each version of MVC 2, 3 , 4, 5 and 6?
What are HTML helpers in MVC?
What is the difference between “HTML.TextBox” vs “HTML.TextBoxFor”?
What is routing in MVC?
Where is the route mapping code written?
Can we map multiple URLs to the same action?
Explain attribute based routing in MVC?
What is the advantage of defining route structures in the code?
How can we navigate from one view to other view using a hyperlink?
How can we restrict MVC actions to be invoked only by GET or POST?
How can we maintain sessions in MVC?
What is the difference between tempdata, viewdata, and viewbag?
What is difference between TempData and ViewData ?
Does “TempData” preserve data in the next request also?
What is the use of Keep…

A Corporate Story #AmNotAuthor #JustSharing

Every day, a small 🐜 Ant arrives at work very early and starts work immediately. 🐜 She produces a lot and she was happy. The Chief, 🐯 a Tiger, was surprised to see that 🐜 the Ant was working without supervision. 🐯 He thought if the 🐜 Ant can produce so much without supervision, wouldn’t she produce even more if she had a supervisor! So 🐯 he recruited a 🐝 Bee who had extensive experience as πŸ‘· supervisor and who was famous for πŸ“ writing excellent reports. The 🐝 Bee’s first decision was to set up a πŸ”” clocking in attendance system. 🐝 He also needed a secretary to help him write and type his reports and he recruited a πŸ‡Rabbit , who managed the archives and monitored ☎ all phone calls. 🐯 The Tiger was delighted with the 🐝 Bee's reports and asked him to produce πŸ“Š graphs to describe production rates and to analyse πŸ“‰ trends, so that he could use them for πŸ“ presentations at Board‘s meetings. So the 🐝 Bee had to buy a πŸ’» new computer and a Laser printer and recruited a ?…

How To Create The Data Adapter Object Using ADO.NET by #RathrolaPremKumar

By reading this article, you will learn key points in ADO.NET, as given below. What is Data Adapter?Primary Data Adapters for the databases.Data Adapter properties.Methods used by Data Adapter.How to create Data Adapter with an example? Let’s start our demo with a Data Adapter introduction. Actually, we use Data Adapter object to establish the connection to the data source and manage the movement of date to and from the database. What is Data Adapter? A data adapter aobject serves as a bridge between a data set object and Data Source such as a database to retrieve and save the data. Data adapter contains a set of database commands and a database connection, which we use to fill a dataset object and update the Data Source. Primary data adapters for databases? .NET makes two primary data adapters available for use with the databases. Other data adapters can also be integrated with Visual Studio .NET. Primary Data Adapters are mentioned below. OleDbData Adapter, which is suitable for use wi…