Posts

Showing posts from November, 2013

SharePoint Query Classes and where to use them

Thanks to http://sivanesanb.blogspot.in/2013/02/sharepoint-query-classes-and-where-to.html

Add calculated data columns to datatable c#

DataTable workTable = new DataTable("Purchase Items"); DataColumn workCol = workTable.Columns.Add("ID", typeof(Int32)); workTable.Columns.Add("UnitPrice", typeof(Double)); workTable.Columns.Add("Qty", typeof(Int32)); workTable.Columns.Add("Total", typeof(Double)); workTable.Columns.Add("Discount", typeof(Double)); workTable.Columns["Total"].Expression = "UnitPrice*Quantity"; workTable.Columns["Discount"].Expression = String.Format("Total*{0}",Discount); dataGridView1.DataSource = workTable; dataGridView1.Update();

Interop type 'Microsoft.Office.Interop.Excel.ApplicationClass' cannot be embedded. Use the applicable interface instead.

In most cases, we are using the Interop Excel class like below. Excel. ApplicationClass  xlapp =  new  Excel. ApplicationClass (); Here it is enough to say that Excel.ApplicationClass derives from Excel.Application interface and one can even instantiate Excel using Excel.Application interface. Rewriting this code as below produces exact same results: Excel. Application  xlapp =  new  Excel. Application (); Typically, to change your code to use an interface type instead of a class type you just need to remove the 'Class' suffix and compile the code! Another way to find what the applicable interface is - look at the definition of the class type.

How to get to the DLLs in the GAC

Start -> Run -> C:\windows\assembly\gac_msil

Applying custom color to SharePoint 2013 Calendar

Image
LoadSodByKey("SP.UI.ApplicationPages.Calendar.js", function () {         WaitForCalendarToLoad();     });     var SEPARATOR = "|||";     function WaitForCalendarToLoad() {         SP.UI.ApplicationPages.SummaryCalendarView.prototype.renderGrids = function SP_UI_ApplicationPages_SummaryCalendarView$renderGrids($p0) {             var $v_0 = new Sys.StringBuilder();             var $v_1 = $p0.length;             for (var $v_2 = 0; $v_2 < $v_1; $v_2++) {                 this.$7V_2($v_2, $p0[$v_2]);             }             for (var $v_3 = 0; $v_3 < $v_1; $v_3++) {                 $v_0.append('<div>');                 this.$I_2.$7Q_1($v_0, $p0[$v_3], $v_3);                 $v_0.append(this.emptY_DIV);                 $v_0.append('</div>');             }             this.setInnerHtml($v_0.toString());             ColourCalendar();         }         SP.UI.ApplicationPages.CalendarStateHandler.prototype.onItemsSucce