March 24, 2015
Sometimes there will be a huge data to loop through but you need to check for few iterations only say 10. In that case items collections in foreach loop contains a built in method to limit the iterations.TAKE
foreach (Object o in collection.Items.Take(10))
Returns a specified number of contiguous elements from the start of a sequence. (Defined by Enumerable.)
February 17, 2015
SPUser user = properties.Web.CurrentUser;
February 2, 2015
We need to use DataView.Sort Property
Let us consider you already have a Datatable dt with some content in it and you want sort it in ascending order by the column Rollno
DataView dvt=new Dataview(dt);
//then again assign that view to datatable dt.
January 21, 2015
Sometimes, you need to uninstall Windows Service Bus 1.0 and it will not disconnect “Leave the Farm”
1) Open Run and Type regedit
Delete the \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Service Bus folder
Then go and do uninstallation it will be perfect
January 16, 2015
Using document library when we upload a document suppose if we upload a pdf document . You can see a small pdf icon.
Based on the document type the icons will map in Default Document Library in SharePoint 2013.
Similarly we need to get that while doing programmatically for that we can make use of SPUtility.MapToIcon
The original location of icons in the server will be at: C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\IMAGES
while in program the path will be like:http://doaminname:portnumber/_layouts/images/icdoc.png
string icon = SPUtility.ConcatUrls(“/_layouts/images”,SPUtility.MapToIcon(item.Web, SPUtility.ConcatUrls(objSPListItem.Web.Url, objSPListItem.Url), “”, IconSize.Size16));
Use Image Control in ASP.net
Image.Url=objSPListItem.Web.Url + icon;
Then you will get the icon related to the document type.
Note: SPUtility in sharepoint 2013 is a wonderful class which includes many useful methods.
Visit for more info: SPUtility
September 18, 2014
Sometimes we will debug an ASP.net webapplication by attaching a W3WP.exe process. While Attaching it will many w3wp.exe. To Know the particular w3wp.exe process for our webapplication we need to type a command in CMD.
1) Click Start
2) Run CMD
3) Goto folder by changing directory cd Windows > System32 > Inetsrv
4) Run appcmd list wp
then you will see all the list of processes