avatar Bipul Raman Engineer | Speaker

Performance enhancement tips while using CAML Query in SharePoint
Posted by Bipul Raman on July 24, 2016.

Putting a lot of design customization, custom codes on SharePoint may cause several performance issues. But the main challenge for a developer is to fulfill all the feasible business requirement of client without hitting down the performance. Enhancing performance cannot be done in single step. In fact, at every step of coding you need to take care of it. You need to review every single line of code and justify if it is really needed or can be optimized in other way.

In this article, I will be discussing performance enhancement tips very specific to CAML Query. Whenever you are requesting any data from SharePoint, you use CAML query to filter it based on your parameters. You can use these parameters in CAML Query to enhance the performance.
  • Where : To put conditions or filters such as equals, contains etc.
  • OrderBy : To order the data. Instead of manipulating data later, do it in CAML itself.
  • ViewFields : To load data from selective fields
  • RowLimit : To load data in limited counts
Here is a sample CAML Query which is getting data from a list putting these parameters
  • When List Item Title is equal to 'Test'
  • Ordering data in Ascending Order
  • Loading data for only two fields: 'Title' & 'Code' 
  • Loading only 3 list items
<View>
    <Query>
        <Where>
            <Eq>
                <FieldRef Name="Title" />
                <Value Type="Text">Test</Value>
            </Eq>
        </Where>
        <OrderBy>
            <FieldRef Name="Title" Ascending="True" />
        </OrderBy>
    </Query>
    <ViewFields>
        <FieldRef Name="Title" />
        <FieldRef Name="Code" />
    </ViewFields>
    <QueryOptions>
        <ViewAttributes Scope="RecursiveAll" />
    </QueryOptions>
    <RowLimit>3</RowLimit>
</View>
Note:
<ViewAttributes Scope="RecursiveAll" />
is used to load data from folders situated inside the lists.

Always remember, this thumb rule while requesting any data from the server
"Request only those data which is really required"

Configuring SharePoint without Active Directory Account
Posted by Bipul Raman on July 23, 2016.

When you are installing SharePoint (2016 or 2013) on your development machine outside any organization's network, you will not be having any Active Directory account to complete the SharePoint configuration wizard. In such scenario, If you try to configure SharePoint, an error will prompt saying that you cannot configure a SharePoint Farm with a local account.

To resolve this issue, there is an interesting and quick solution. You can use below command in SharePoint Management Shell. Please note, always run SharePoint Management Shell in Administrative Mode.

Command:
New-SPConfigurationDatabase -localserverrole SingleServerFarm
The New-SPConfigurationDatabase cmdlet creates a new configuration database on the specified database server. This is the central database for a new SharePoint farm.

One you run the above command, It will prompt and ask below parameters (as displayed in the picture):
  • DatabaseName: Configuration Database Name
  • DatabaseServer: SQLServer
  • FarmCredentials: Farm Admin Credentials
  • Passphrase: It can be of your own choice, kind of password

After running the command, Run the SharePoint Configuration wizard, It will automatically select the Farm and Configuration Database and becomes ready to mode to next step.

Note: This method is tested and working for SharePoint 2016 & 2013 both.

Resolving Space Issues on SharePoint Server caused due to SP Logs
Posted by Bipul Raman on July 05, 2016.

Well, freeing space on server, cleaning up logs are usually admin tasks, but in case of Development servers, Mostly Developers are doing those tasks. Therefore, this particular article i have written from developers prospective.

Case & Solution:  
In case your SharePoint  Server is running out of Storage, Please check with Win Dir tool as shown in the above image. You can download that tool from below link: 
Download URL: https://windirstat.info/download.html

In most of the cases it is due to Logs files created by SharePoint.By inspecting WinDirStat tool, If you find any DATA folder under Program Files >> SQL Server >> … >> is occupying exceptionally high space,List out which DB logs are taking more spaces.
Run the below SQL scripts. Replace the WSS_Content_DB with Actual DB name which occupying higher space. Repeat the process for every single DB which is taking more space.

SQL Script: