Posts

Right way to add CSS and JavaScript to SharePoint App Pages and Master-Pages

In SharePoint-Hosted App, there is a special way to embed your JavaScript and CSS. Adding JavaScript: To add JavaScript that resides in the "layouts\15" folder, just specify the file name: < SharePoint:ScriptLink name=" sp.core.js " runat="server" LoadAfterUI="true" Localizable="false" /> To Add JavaScript that resides in your app, for example in "Scripts" folder of your SharePoint-Hosted App: <SharePoint:ScriptLink name=" ~site/Scripts/App.js " runat="server" OnDemand="false" LoadAfterUI="true" Localizable="false"></SharePoint:ScriptLink> Adding CSS: To add CSS to a SharePoint-Hosted App, you need to know how SharePoint works, its a bit different form that way JavaScript is embedded in the app. Initially I thought, I could use "<SharePoint:CssLink" just the way I used "<SharePoint:ScriptLink", but it wasn't true. Sha...

Knockout binding in SharePoint 2013 SharePoint-Hosted App

Today I was trying to make Knockoutjs work with SharePoint Hosted Apps in a way that is manageable and extensible. I assume you already know Knockout JS and know how to create a basic SharePoint-Hosted App. There can be many ways using which KO can be plugged into an application but here here is what I think would work well for SharePoint-Hosted Apps considering async JSOM calls: Step1: Add Knockout JS Just download the js file and paste inside the Scripts folder. Refer it in your Default.aspx page. Step2: Add html binding In the Default.aspx page of SharePoint 2013 Hosted put the following code in the "<p id="message">" tag: Welcome <span data-bind="text: username"></span> Step3: Apply KO Bindings At the bottom of the Default.aspx page put the following code:     <script >         var viewModel = new window.MyApp.ViewModel();         viewModel.load();         ko.applyB...

SharePoint 2013 Online and ASP.NET Web API using JSONP

Consider a scenario where you have to display data or make decisions on a SharePoint 2013 page based on the data that exists in a database. Here is what you can do: Abstract: 1. Create an Empty ASP.NET Web API project. 2. Enable the project for JSONP format 3. Add the Controller, Model, the business and data access logic to the service 4. Deploy the Service 5. Add script to SharePoint 2013 page Details: 1. Create an Empty ASP.NET Web API project. This is fairly simple step, all you need is MVC4 or above and .NET Framework 4.5. Using Visual Studio 2012/2013, Add new project, select an empty project and check the Web API box and click OK. 2. Enable the project for JSONP format: - Open package manager in visual studio (Tools&gt;NuGet Package Manager &gt; Package Manager Console and run the following command, it will add the required dlls to your project: Install-Package WebApiContrib.Formatting.Jsonp - In App_Start folder of the project, create a new class: ...

Future of Hard-Disk Drives?

All tape drives of the past and most recent high capacity drives used today after all are magnetic drives (which use "ferromagnets" to store bits). Then Solid State Drives (SSDs) gave a new direction of fastest drives. I think that's the future of hard-drives for another 5 years. However, what if we had a mixture of two? The real future of storage I think will be storage using atomic structures with an addressing scheme and algorithm of an SSD and a four-atom-wide wires. Instead of flip-flops, "antiferromagnets" will be used and result will be lightening fast drives with thousands of TB of storage... ? Read about flip-flop replacement: Tiny hard drive stores one byte of data with just 12 atoms About connecting-wire replacement: Four-atom-wide wire may herald tiny computers I am ready to buy that drive as soon as it becomes available ;)

Microsoft Visual Studio Useful Shortcuts

Here is a link where Visual Studio shortcuts are available which can make you efficient developer if you make good use of them… http://msdn.microsoft.com/en-us/library/da5kh0wa.aspx

IE 6 is ending in January 2012

So Microsoft has planned to give a new year present by forcefully pushing IE6 to the next world. They have decided to upgrade everyone's browser to maintain a minimum version. Read more here: IE to Start Automatic Upgrades across Windows XP, Windows Vista, and Windows 7

SQL Server Management Studio 2008 (SSMS) - Intellisense is not working

The SSMS intellisense wasn't working for me when we migrated our database server from 2005 to 2008. Here is what I used and its working for me pretty well. http://www.devart.com/dbforge/sql/sqlcomplete/download.html Install the Express version of it and it does the job!

Google DART - A Structured way of web programming

How often do you see a new programming language launched? Yes, its very rare. Google today has launched a new programming language called DART which seems similar to C/C++ and Java. Following up here: Google Dart - A javascript alternative and http://www.dartlang.org/

Microsoft Security Essentials and Google Chrome

Recently, Microsoft Security Essentials (MSSE) installed on my PC detected a "Password Stealer". I opted to delete the "password stealer". Then I tried to open my Chrome browser and BOOM, it crashed saying the file doesn't exist. I figured out that the "password stealer" deleted by MSSE was in fact Google Chrome. I reinstalled Chrome, but that won't run saying a permission error. Here is what I did to solve that: 1. Go to: C:\Documents and Settings\ \Local Settings\Application Data\Google\Chrome\Application 2. Run chrome_new.exe That's it, now run Chrome.exe, and you should be able to use Google Chrome again.

Quick Code Documentation

Documentation of Code seem the least "productive" task but it is important. I have always been adding comments in the code but until today, I couldn't find a "great" tool that could do more than just copying my comments and display in an auto-generated documentation. Then, here is what I found, an automated documentation generating tool: 1. Download and install "Doxygen" http://www.stack.nl/~dimitri/doxygen/index.html 2. Install GraphViz (open source majorly funded by AT&T) http://www.graphviz.org/ 3. While generating the documentaion through "Doxygen", mention "Use dot tool from the GraphViz Package" option if you are on the Wizard > Diagrams tab. 4. Create Folder in which you want to have the documentation generated and specify other preferences. 5. You'll have to select "Run" tab and say "Run Doxygen" to generate to documentation. Open "Index.html" to start viewing the docum...

Cannot add a SimpleContent column to a table containing element columns or nested relations

Recently I ran into a problem while dealing with DataSets. I was adding a colum to an XSD through Visual Studio desinger and it kept failing with following error: Cannot add a SimpleContent column to a table containing element columns or nested relations. This is a known issue. However, the solution is not well known :) To be simple and streight forward, I tell you the solution which I tried and it worked, 1. Note down the column names, datatypes and relationships of the table. 2. Delete the table. 3. Add new table and add columns to it. 4. Redefine relationships. Best of luck.

Search All Tables in SQL Database for a Value

You can use the following query to perform your search. Just replace the "@myValue" with your value. Declare @TN as varchar(200), @CN as varchar(200), @myValue varchar(30), @SQL as nvarchar(1000) , @SN as varchar(200), @Exact_Match bit Create Table #myTable (Table_Name varchar(200), Column_Name varchar(200), Number_Of_Rows int) -- Replace @myValue with the value you're searching for in the database Set @myValue = 'Value to Search' -- 0 for LIKE match, 1 for exact match Set @Exact_Match = 1 Declare myCursor Cursor For Select T.Table_Name, C.Column_Name, T.Table_Schema From INFORMATION_SCHEMA.TABLES T Inner Join INFORMATION_SCHEMA.COLUMNS C On T.Table_Schema = C.Table_Schema And T.Table_Name = C.Table_Name Where T.Table_Name 'dtproperties' And Table_Type = 'Base Table' And C.Data_Type In ('varchar','char','nvarchar','nchar','sql_variant') --And C.Data_Type In ('text','ntext...

SharePoint 2010 PowerShell cmdlets

http://technet.microsoft.com/en-us/library/ee890108.aspx

Enabling/ Disabling Developer Dashboard in SharePoint 2010

Developer dashboard is not only for Developers, the administrators can also take good advantage of it. They can do quantitative analysis if their site is slow then how much slow and when the users started raising complaints. There are three in which this DD can remain: 1. OFF (which is by default) 2. ON - which turns it on all the time. It is generally not a good option as it causes performance overhead and turning it on would make all the Site Collection Admins to see it. 3. On Demand – It appears like a small button and site collection admins can turn it on any time they want. This is most feasible option. To set it to OnDemand, execute following powershell cmdlets: $dd = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings $dd.DisplayLevel = ‘OnDemand’ $dd.TraceEnabled = $true $dd.Update() This is enabled on the whole farm so you can go and look the the Right-Top of the site where a white colored button should appear. Upon clicking...

The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.

Image
  While configuring the SharePoint 2010 for Forms Based Authentication, I encountered above error. To get the problem, I had to change “IncludeExceptionDetailInFaults” to true somewhere. But WHERE? Here is what solved my problem: Go to following path: 1. C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebServices\SecurityToken 2. Open Web.config there. 3. Add following in the “behaviors > serviceBehaviors > behavior” node. <serviceDebug includeExceptionDetailInFaults="true"/> Now try to login and see what error it gives, off to a next error

SharePoint 2010 Error Log Viewer

Perhaps I posted this before, but if not, I am posting again for my reference. Use this tool to view SharePoint 2010 Error Logs: http://code.msdn.microsoft.com/ULSViewer/Release/ProjectReleases.aspx?ReleaseId=3308 SharePoint 2010 Log files are usually located here, sort by date and open the latest one in the ULS Viewer: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS Create a “Filter” and select “Message” and enter “Error” in value. This should give you all error entries in the file and you can find out what is wrong.

Before Uninstalling the Filestream Provider for Remote Blob Storage for SharePoint 2010

Before uninstalling the Filestream provider, make sure that you have content migrated back in the content database. To ensure this, just open “AllDocStreams” in the SharePoint Content database and look at the “Content” and “Rbsid” columns. the “Rbsid” columns should be NULL and “Content” column should be filled with data. If you uninstall the RBS provider before migrating the data back in the content database, all the data will become unavailable/ inaccessible. Use following command to Migrate content back and forth from and to DB to Blob Store: $rbss.SetActiveProviderName(“”) $rbss.Migrate()

Enabling Remote Blob Storage on Content Database Again

The scenario was, I installed the RBS with Filestream and uninstalled the RBS and realized that all the blobs are still out there on file system due to which the uninstall process failed. Now I tried to call $rbss.Migrate() in PS but it failed because the RBS was no longer installed! I tried to call $rbss.Enable() but it failed with an error saying “SQL Remote Blob Storage should be installed on the web front end and content database before your can enable it” something like that. I re-installed RBS and filestream provider but it didn’t let me enable it and kept giving error. RESOLUTION and Lesson Learnt: To resolve the error, I re-booted the server and it worked. It is important to note that after installing RBS, it is required to restart the windows if are failing to “Enable” it on the content database.

SharePoint Remote Blob Store with FILESTREAM Provider

To provision a Remote Blob Storage with FILESTREAM Provider provided by Microsoft, you have to follow instructions in this article: http://technet.microsoft.com/en-us/library/ee663474.aspx Things to NOTE: 1. For me, the tables with prefix mssqlrbs in the content database somehow didn’t appear by running the following command so I had to use wizard to create those tables in the content database instead of following command: msiexec /qn /lvx* rbs_install_log.txt /i RBS_X64.msi TRUSTSERVERCERTIFICATE=true FILEGROUP=PRIMARY DBNAME=" <ContentDbName> " DBINSTANCE=" <DBInstanceName> " FILESTREAMFILEGROUP=RBSFilestreamProvider FILESTREAMSTORENAME=FilestreamProvider_1 Where: <ContentDbName> is the database name. <DBInstanceName> is the SQL Server instance name. 2. To Migrate all the data from Database to newly provisioned Blob Store, just execute following cmdlets in SharePoint Powershell: $cdb = Get-SPContentDatabase -WebApplication < http://...

SharePoint 2010: Specified value is not supported for the parameter

Make sure AD is accessible. If you are not connected to domain directly, make sure you have VPN connected. Hope this helps…