Posts

Showing posts from 2013

Customize SharePoint 2013 and Office 365 suite bar

http://academy.bindtuning.com/customize-sharepoint-2013-and-office-365-suite-bar/

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

Getting SharePoint List Items using JQUERY

< script type ="text/javascript" src ="/_layouts/images/Tri/jquery-1.6.1.min.js"></ script > < script type ="text/javascript" src ="/_layouts/images/Tri/jquery.SPServices-0.7.2.min.js"></ script > < script language ="javascript" type ="text/javascript">     $(document).ready( function () {         $().SPServices({             operation: "GetListItems" ,             async: false ,             listName: "Tasks" ,             CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>" ,             completefunc: function (xData, Status) {                 $(xData.responseXML).SPFilterNode( "z:row" ).each( function () {                     var liHtml = "<li>" + $( this ).attr( "ows_Title" ) + "</li>" ;                     $( "#tasksUL" ).

SharePoint 2010 SP1 - Recovering Deleted Sites and Site Collections

Image
Get-SPDeletedSite  – this command gets a list of all deleted Site Collections in your farm. Restore-SPDeletedSite  – this command is used to restore a deleted Site Collection within your farm Remove-SPDeletedSite  – this command is used to actually clear out any deleted Site Collection you no longer want to keep (think "Empty Recycle Bin"). hope this will helps you ... happy coding ..

Create web application using powershell in SharePoint 2013

Image
The PowerShell cmdlet is given below : New-SPSite -Url "http://url of the site" -OwnerAlias "<Domain\Administrator>" -Template "STS#0" Hope this will helps you... Happy coding...

Demo the use of SPCalendarView (CSSharePointCustomCalendar)

Click here to View Details Hope this will helps you... Happy coding...

SPCalendarView in sharepoint 2010 placed on custom aspx / ascx page does not respond to any actions

RESOLUTION/ WORKAROUND 1. Webpart containing SPCalendarView ; inherting from System.Web.UI.WebControls.WebParts.WebPart    has issues. The Day/ Month/Year & many more navigations & hyperlinks do not work. 2. SOLUTION : Webpart containing SPCalendarView ;inherting from Microsoft.SharePoint.WebPartPages.WebPart works with no issue. NOTE : here we are not making any changes in rendering level. We still will get the v4 rendering looks. More Details : Click Here to View Hope this will helps you.. Happy Coding...

CustomAction Element

http://msdn.microsoft.com/en-us/library/ms460194.aspx

Create a Custom Action in Site Action\Settings in SharePoint 2013

Visual Studio 2012 --> SharePoint 2013 Project -->Right Click on the Project ---> Add New Item--> Empty  Element <? xml version = " 1.0 " encoding = " utf-8 " ?> < Elements xmlns = " http://schemas.microsoft.com/sharepoint/ " >   < CustomAction   Id = " NewID "   GroupId = " SiteActions "   Location = " Microsoft.SharePoint.StandardMenu "   Sequence = " 2000 "   Title = " My Link "   Description = " Create My Link " >     < UrlAction Url = " ~/_layouts/15/Test.aspx " />   </ CustomAction > </ Elements > Hope this will helps you... Happy Coding...

CrossListQueryInfo in SharePoint

                   The CrossListQueryInfo object uses the CrossListQueryInfo object to get the cached results or, if there are no cached results available, it performs a cross-list query to the database and then caches the results for future use .        CrossListQueryInfo clqi = new CrossListQueryInfo ();                         clqi.Query = "<OrderBy><FieldRef Ascending=\"FALSE\" Name=\"Title\" /></OrderBy><Where><BeginsWith><FieldRef Name=\"Title\" /><Value Type=\"Text\">Test</Value></BeginsWith></Where>" ;                         clqi.ViewFields = "<FieldRef Name=\"Title\" /><FieldRef Name=\"ContentType\" />" ;                         clqi.Lists = "<Lists BaseType=\"1\" />" ;                         clqi.Webs = "<Webs Scope=\"SiteCollection\" />" ;            

Query SharePoint List - SPQuery vs SPSiteDataQuery vs CrossListQueryInfo

Click here hope this will help you...

Add Blocked File Types in SharePoint 2010

string webAppUrl = "Your URL" ;                 string myBlockFileType = "dll" ;                     Uri myUri = new Uri (webAppUrl);                     SPWebApplication myWebApp = SPWebApplication .Lookup(myUri);                     Collection< string > blockFileTypes = myWebApp.BlockedFileExtensions;                     blockFileTypes.Add(myBlockFileType);                     myWebApp.Update(); Hope this will helps you... Happy Coding....

Displaying the FileUpload Control image in Image Control Inside the GridView

scenario :   Display the image in the asp Image control while uploading by using Javascript...   Here you go with the solution..... function GetImage(field, rowIdx, col) {                           var cellValue = 0;             var currValue = 0;               rowIdx = parseInt(rowIdx) + 1;             var objGridView = document.getElementById( ' <% =newGrid.ClientID %> ' );             cellValue = objGridView.rows[rowIdx].cells[3].children[0];              cellValue1 = objGridView.rows[rowIdx].cells[3].children[1].value;             var ext = cellValue1.substring(cellValue1.lastIndexOf( '.' ) + 1);             if (ext == "gif" || ext == "GIF" || ext == "JPEG" || ext == "jpeg" || ext == "jpg" || ext == "JPG" || ext == "png" || ext == "PNG" ) {                 objGridView.rows[rowIdx].cells[3].children[0].src = cellValue1;       

Getting values from SharePoint calculated column

Here you go for getting values from the Calculated column. SPFieldCalculated  month = ( SPFieldCalculated )oitem.Fields[ "Month" ]; SPFieldCalculated  year = ( SPFieldCalculated )oitem.Fields[ "Year" ]; lblOrderConformation.Text =  "ORDER CONFIRMATION IN - "  + month.GetFieldValueAsText(oitem[ "Month" ]) +  " "  + year.GetFieldValueAsText(oitem[ "Year" ]); Hope this will help you ....

How to Restore SQL Server 2008 R2 Suspect Database

EXEC   sp_resetstatus   'YourDatabaseName' ; ALTER   DATABASE  YourDatabaseName  SET   EMERGENCY DBCC  checkdb ( 'YourDatabaseName' ) ALTER   DATABASE  YourDatabaseName  SET   SINGLE_USER   WITH   ROLLBACK   IMMEDIATE DBCC  CheckDB   ( 'YourDatabaseName' ,  REPAIR_ALLOW_DATA_LOSS ) ALTER   DATABASE  YourDatabaseName  SET   MULTI_USER Hope this will helps you !!!

Disable Key press on SharePoint:DateTimeControl

Sharepoint DateTime control is placed in a Webpart or Application Page. We need to allow the users to select the Date from the Date Picker ICON in the DateTime Control to avoid the typing in the DateTime Control TextBox. Here you go for the solution : In Code behind : (( TextBox )(dtpClearfrmCustoms.Controls[0])).Attributes.Add( "readonly" , "readOnly" ); In Source Page : < SharePoint : DateTimeControl ID ="dtpClearfrmCustoms" runat ="server" DateOnly ="true"                         LocaleId ="2057" /> JavaScript validation for SharePoint DateTime Control if (document.getElementById( ' <% = dtpClearfrmCustoms.Controls[0].ClientID  %> ' ).value == "" ) {   alert( "Please select the date" );                 return false ;     } Hope this would helps you....

Multi Level Grouping in SharePoint List Programmatically

<SharePoint:ListViewByQuery ID="TestID" runat="server" /> In Code Behind:  SPList oList = web.GetList("SampleList"); TestID .List = oList; SPQuery query = new SPQuery(oList.DefaultView); query.Query= "<GroupBy Collapse='FALSE'><FieldRef Name='Title' /><FieldRef Name='Subject' /></GroupBy>"; TestID .Query = query; Hope this will helps you!!! Happy coding....

ASP.net Ribbon

Ref :  http://aspnetribbon.codeplex.com/

How to print a panel in SharePoint 2010

< Script type ="text/javascript">         function printform() {             var printContent = document.getElementById( " <% = pnlFullForm.ClientID %> " );             var windowUrl = "about:blank" ;             var uniqueName = new Date();             var windowName = "Print" + uniqueName.getTime();             var printWindow = window.open(windowUrl, windowName, "left=50000,top=50000,width=0,height=0" );             printWindow.document.write(printContent.innerHTML);             printWindow.document.close();             printWindow.focus();             printWindow.print();             printWindow.close();         } </ script > ********************************************** < input type ="button" value ="Print" id ="btnPrint" title ="Print" onclick ="printform();"                     class ="ms-ButtonHeig

Controls not working after Export to Excel or Export to PDF

Add the following script to your webpart / custom control that need to have export and other controls functionals So here you go with the working solution. < script type ="text/javascript" language ="javascript">     //sharepoint postback to work after clicking on export to excel button     if ( typeof (_spBodyOnLoadFunctionNames) != 'undefined' &&                                            _spBodyOnLoadFunctionNames != null ) {         _spBodyOnLoadFunctionNames.push( "supressSubmitWraper" );     }     function supressSubmitWraper() {         _spSuppressFormOnSubmitWrapper = true ;     } </ script > Hope this will helps. Reference : Click here