Maximum Upload Size in SharePoint 2013

One of new and hidden feature in SharePoint 2013 is that you can specify the maximum upload size per file type 😉

Actually the default maximum upload is 250MB and you can modify it from central administration.

But, you can specify the this size as per file type using power shell cmdlet in MB.

$webApp = Get-SPWebApplication “http://sp2013:2000”

So I told SharePoint to allow uploading AVI files up to 500 MB.

And you can see all available file types in their sizes




Deploying SharePoint 2010 Solution on SharePoint 2013

As you know, in SharePoint 2010 there was 14 hive where you deploy your files. And then you reference them like below:


Physical Path: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS

Virtual Path: “/_layouts/<your folder>/<your files>”


In SharePoint 2013, there is new 15 hive

Physical Path: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\LAYOUTS

Virtual Path: “/_layouts/15/<your folder>/<your files>”


If you have SharePoint 2010 solution (.wsp file) and you need to deploy it on SharePoint 2013, then you have the following options:

First, you have to add the solution to your farm using PowerShell as following:

  • Add-SPSolution C:\SP2010Project.wsp


  • Deploy to 14 hive è
    Install-SPSolution sp2010project.wsp
  • Deploy to 15 hive è Install-SPSolution sp2010project.wsp -CompatibilityLevel 15

How to Read from SharePoint 2013 List in 6 Ways

Suppose we have SharePoint 2013 and contains a list called “Users”

Now, there are 6 ways to ready the items for this list:

  • SharePoint 2013 Object Model (C#)
  • Client Side Object Model (CSOM)
  • SharePoint 2013 Web Services
  • REST/OData
  • Power Shell
  • LINQ

First, we need to install Microsoft Office Developer Tool for VS 2012 from this link,

because the VS 2012 come without and project for SharePoint 2013

After installing this your VS new project window will be like:

SharePoint 2013 Object Model (C#)

In this example I will create a new project of type “SharePoint 2013 – Visual Web Part”

In the user control, add a GrivView:

<asp:GridView runat=”server” ID=”grvUsers” />

In the Page Load event write the following code snippet

using (SPSite site=new SPSite(SPContext.Current.Site.Url))


using (SPWeb web=site.OpenWeb())


SPList list = web.Lists[“Users”];

grvUsers.DataSource = list.Items.GetDataTable();




  • Right click on the project and deploy it
  • Go to any SharePoint page and edit the page
  • Insert your web part into your page from “Custom” group
  • Save and close the page

Client Side Object Model (CSOM)

CSOM is a good choice for running a console or windows application on the end user machine and interact with

SharePoint 2013

Create a new project of type “Console Application”

For this, we need to add the following references:

  • Microsoft.SharePoint.Client
  • Microsoft.SharePoint.Client.Runtime

In the Main method write:

ClientContext cc = new ClientContext(“http://sp2013:2000&#8221;);

Web web = cc.Web;

List list = web.Lists.GetByTitle(“Users”);

CamlQuery caml=new CamlQuery();

ListItemCollection items = list.GetItems(caml);




foreach (Microsoft.SharePoint.Client.ListItem item in items)





SharePoint 2013 Web Services

To read from SharePoint list using web services and jQuery, use

And for full documentation follow this link$().SPServices&referringTitle=Documentation

  • Copy the following JS files to SharePoint layouts “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\LAYOUTS”
    • jQuery
    • SPServcies
  • Open SharePoint Designer 2013
  • Open the your site collection
  • Go to your master page
  • Open it and write the following scripts

<script src=”/_layouts/15/jQuery.js” type=”text/javascript” ></script>

<script src=”/_layouts/15/jQuery.js” type=”text/javascript” ></script>


operation: “GetListItems”,

async: false,

listName: “Users”,

CAMLViewFields: “<ViewFields><FieldRef Name=’Title’ /></ViewFields>”,

completefunc: function (xData, Status) {

$(xData.responseXML).SPFilterNode(“z:row”).each(function() {





Power Shell

In Power Shell you can use the following script:

$web=Get-SPWeb http://sp2013:2000




You use for-each in Power Shell to iterate through all items.

foreach ($item in $list.Items)

{Write-Host $item.Title}


For using REST you have two options:

  • jQuery
  • C# (HttpRequest & HttpResponse)

For REST reference follow this link OData in SharePoint 2013 – Lists and Items


To use LINQ, we will use SPMETAL

This will generate a CS file in C:\

Add this file to your application (Console or Windows)

Also, you need to add the following assembly

  • Microsoft.SharePoint.Linq

  • Add the generated class in Power Shell script to your project
  • Wirte the following code

MyWebDataContext context = new MyWebDataContext(“http://sp2013:2000&#8221;);

List<UsersItem> items=context.Users.ToList();

foreach (UsersItem item in items)





PowerShell Issue after Installing SharePoint 2010 SP1

After installing SharePoint 2010 SP1 on my VM, I opened the PowerShell to execute one Cmdlet.

But L , I got the following error in any CmdLet..

The complete error is:

Install-SPRSServiceProxy : Microsoft SharePoint is not supported with version

4.0.30319.17626 of the Microsoft .Net Runtime.

At line:1 char:1

+ Install-SPRSServiceProxy

+ ~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidData: (Microsoft.Repor…ingServiceProxy:

InstallReportingServiceProxy) [Install-SPRSServiceProxy], PlatformNotSuppo


+ FullyQualifiedErrorId : Microsoft.ReportingServices.SharePoint.PowerShel



Right click on “SharePoint 2010 Management Shell”

After the properties windows opened, you will see the below screen

Add “-version 2” in the Target field

Try now 😉

The source was not found, but some or all event logs could not be searched.

The complete exception is :

System.Security.SecurityException: The source was not found, but some or all event logs could not be searched.

This happen when you are using in your code (C#) windows log events.

EventLog.WriteEntry(method, log_message, type);

Now, how to create this source in windows event log.


Using windows powershell.

  1. Run windows powershell under administrative privileges
  2. Run the following command New-EventLog -LogName Application -Source <YOUR SOURCE>

You have chosen to delete too many site groups at once

I have a list with 3000 users permission and I need to delete them, but when I select the root checkbox

and tried to delete the all, I got the following error message:

You have chosen to delete too many site groups at once. Select fewer site groups and try again.


I used PowerShell to delete them 😉

Below is the script…

$web=Get-SPWeb http://dev:2000/


foreach($acc in $web.RoleAssignments)




$account = $web.EnsureUser($acc.Member.LoginName)





Write-Host $acc.Member.LoginName




Restore SharePoint 2010 UI To ShaerPoint 2007 UI

After you upgrade your SharePoint from 2007 to 2010. The you an option to upgrade the UI using “Visual Upgrade”.
IF you upgraded it to the new UI in 2010 and for some reasons you need to back to 2007 UI.


Open powershell and write the followoing Cmdlets:
$web=Get-SPWeb http://<servername&gt;:<port>:/subsite1/subsite2


for more information visit Microsoft here.