Monday, August 10, 2015

After and Before Properties in Sharepoint Event receivers

Below are the list of differences in Item Properties
List
ListBeforePropertiesAfterPropertiesproperties.ListItem
ItemAddingNo valueNew valueNull
ItemAddedNo valueNew valueNew value
ItemUpdatingOriginal valueNew valueOriginal value
ItemUpdatedOriginal valueNew valueNew value
ItemDeletingNo valueNo valueOriginal value
ItemDeletedNo valueNo valueNull
Document Library
LibraryBeforePropertiesAfterPropertiesproperties.ListItem
ItemAddingNo valueNo valueNull
ItemAddedNo valueNo valueNew value
ItemUpdatingOriginal valueNew valueOriginal value
ItemUpdatedOriginal valueNew valueNew value
ItemDeletingNo valueNo valueOriginal value
ItemDeletedNo valueNo valueNull
It will help somebody for sure.

Wednesday, April 29, 2015

How to use SPSiteDataQuery in sharepoint

Below is the example how we can use spsitedataquery in sharepoint

using (SPSite site = new SPSite(ServerText.Text))
{
    using (SPWeb web = site.OpenWeb())
    {
        // Fetch using SPSiteDataQuery
        SPSiteDataQuery query = new SPSiteDataQuery();
        query.Lists = "<Lists ServerTemplate=\"105\" />";
        query.ViewFields = "<FieldRef Name=\"Title\" />" +  /* Title is LastName column */
                "<FieldRef Name=\"FirstName\" Nullable=\"TRUE\" Type=\"Text\"/>";
        query.Webs = "<Webs Scope=\"SiteCollection\" />";

        DataTable dataTable = web.GetSiteData(query);
        dataGridView3.DataSource = dataTable;
    }
}

Thursday, April 9, 2015

SharePoint URL Shortcuts

Sandboxed Solution Gallery:
/_catalogs/solutions/Forms/AllItems.aspx

Workflow history hidden list:
/lists/Workflow History

Filter toolbar for Lists and libraries (Added by Asimaili):
?Filter=1

Site usage page (Added by @Dnyag):
/_layouts/usage.aspx

Site content and structure  page (Added by @Dnyag):
/_layouts/sitemanger.aspx

Site settings page (Added by Aowworld):
/_layouts/settings.aspx

View all site content page (Site content) (Added by Aowworld):
/_layouts/viewlsts.aspx

Manage site collection features - CASE SENSITIVE 
/_layouts/ManageFeatures.aspx?Scope=Site

Manage site features :
/_layouts/ManageFeatures.aspx

 Get the version of the SharePoint server (Patch level) :
 /_vti_pvt/Service.cnf

Web Part Maintenance Page :
?Contents=1

Show Page in Dialog View :
?isdlg=1

Application page for registering SharePoint apps :
/_layouts/15/appregnew.aspx

Save Site as a template : 
/_layouts/savetmpl.aspx

Sign in as a different user :
/_layouts/closeConnection.aspx?loginasanotheruser=true

Enable SharePoint designer :
/_layouts/SharePointDesignerSettings.aspx

Welcome Page (Default page settings) :
/_layouts/AreaWelcomePage.aspx

Change Site Master Page :
/_layouts/ChangeSiteMasterPage.aspx

Page Layouts and Site Templates :
/_Layouts/AreaTemplateSettings.aspx

Master Pages library :
/_catalogs/masterpage/Forms/AllItems.aspx

User Information List :
_catalogs/users/simple.aspx

Quick Deploy List :
Quick%20Deploy%20Items/AllItems.aspx

Open Page in Edit Mode :
?ToolPaneView=2

Taxonomy Hidden List (MMS) :
Lists/TaxonomyHiddenList/AllItems.aspx

User Information List :
_catalogs/users/simple.aspx

Force displaying the user profile in the site collection :
/_layouts/userdisp.aspx?id={UserID}&Force=True

View size of all lists and libraries :
/_layouts/storeman.aspx

Wednesday, April 1, 2015

how to get the current ui culture using CSOM

use the below line of code to get the current UI culture

_spPageContextInfo.currentCultureName

Tuesday, March 31, 2015

Trick to know the loaded Jquery file version

Ever wanted to check the version of the jquery file...

try this simple trick..
open console window of the broweser
paste jQuery.fn.jquery and hit enter.


Thursday, March 26, 2015

Why SPServices?

The Client Object Model only works in SharePoint 2010 and does not work for anonymous users. SPServices works the same in both SharePoint 2007 and 2010 and works just fine with anonymous users as long as anonymous users have access to the pages and the scripts. As far as just calling the Web Services directly? Well, that’s basically what SPServices does except it takes care of the heavy lifting for you and wraps the Web Service methods in easy to use functions. So, if you prefer to manually write SOAP envelopes and all that fun stuff, have at it.

Sunday, December 7, 2014

USING MERGE-SPLOGFILE TO FIND CORRELATION ID
When you are hit with a problem in SharePoint 2013 you get notified to use a correlation id to check for further details in the trace logs (ULS logs).

So you hopefully start up ULS Viewer and open up the relevant logs and search like a mad man after this specified correlation id. Sometimes you don’t find the provided correlation id in the log file you opened. Is there a easier way?

Yes and that is to use the SharePoint PowerShell command Merge-SPLogFile. According to the description of Merge-SPLogFile on Microsoft TechNet:
“Combines trace log entries from all farm computers into a single log file on the local computer.”
Let me explain how you can use this powerful command.
Basic Usage
Lets visualise a simple farm.

As the example Farm image above we have two frontend servers, application server and database server. If I wanted to consolidated the last hour of SharePoint log entries from the front-end server and application server I would open up SharePoint Management Shell on one of the servers and type the following command:
Merge-SPLogFile –Path “E:\SPLogs\MergedLogs.log” –Overwrite

Now that was a very basic example to merge the various servers log files. More parameters are available on theMicrosoft TechNet article for Merge-SPLogFile. For example Area, Category, Level, Message, StartTime, EndTime and more.
Finding Correlation ID
What the following example show is how to find the log entries for a specific correlation id:
Merge-SPLogFile –Path “S:\SPLogs\MergedLogs.log” –Correlation 3ae2a6c0-da14-43a1-afda-5bb6bbff3d43 -Overwrite

Since the log files are merged with just the specified correlation id you can load the log file in ULS Viewer to easily view the entries. Please be aware that the log can be empty if the logging level is set to low for the SharePoint category. Just go to SharePoint Central Administration to increase the logging level.

As you can see in the image above the correlation id has 19 matching entries in the log file. Much less log entries to scroll through.
Summary
I hope this helps you on finding SharePoint errors quicker and easier. Let me know what your favourite commands and tools are for debugging SharePoint.