Posts

SharePoint 2013 The name 'InitializeControl' does not exist in the current context

The storyline: I created a visual web part inside my VS2012 solution. Every time I saved the ascx file I had to wait for a few seconds as my VS was 'Communicating with SharePoint'. If you are the type of person who has an addiction of hitting 'Ctrl + S' after modifying a few lines of code then you will find this annoying. Then I tried to switch my solution to 'Offline' to avoid this. I wrote my code and when I did a build it throws me this error. After further investigation it seems that my ascx.g.cs file disappeared. Now I know why it was 'Communicating with SharePoint' every time I saved the file. It's generating the g.cs file that has the InitializeControl function.  So to get it back working, I just switched to online mode, then re-saved my ascx file and voila! my g.cs shows up again.  Interested to see if other people have any ideas to make this faster process. HTH, Andreas

SharePoint 2013 Rest API and Knockout JS

Image
Hi all, Most of the times in public facing websites you want to have a nice fast interaction for users to be able to get the information and we want to display it in a nice looking way. For example a simple question with responses like this: where user can click Yes or No and the response will show and they can go to the next question.  To achieve this we can easily leverage SharePoint capabilities for storing the questions in the list and access them through the REST API. For rendering and interaction we will use the mighty Knockout JS making it all nice and easy. First step is to create your SharePoint list to store your questions: Then you can create a web part to host this little wizard. In your visual web part ascx file, the first thing we want to do is to create a viewmodel and get the data from our list. Using the REST api and with the help of knockout mapping (or wrap) we can get our observables easily. Below is the complete js on my page Then...

CRM 4.0 Useful FetchXML Javascript Helper

Hi again, Although most of you would say CRM 4.0 is outdated, but unfortunately some companies are still using them :) (I know we are in the process of migrating). However just want to let you know I found a post here  that provides useful javascript function to retrieve record through fetchXml. It is useful for let's say based on the lookup id you want to get all the attributes and populate other fields in the form. I have extended that function so you will be able to get attribute lookup name as well (if you want to populate a lookup field). To use it you can do something like this: Hope this helps, Andreas

Mixing User Controls with Knockout JS - How to make it work

Hi all, Just want to let you know quite an awesome way of building your web form or application using by mixing server side and client side technologies. The trick of using knockout js wrapped in separate user controls is very simple: use native binding ! Then you will be able to use normal controls like this: You can grab all the benefits of fast asynchronous client side script. All server side logic can be implemented using web services. Just keep in mind that it is always better to do validation on both ends (i.e. form validation and saved object validation) Other tip: Sometimes when object is too large IE will complain about slow running script. This occurs especially when you are using mapping plugin. Good workaround is to separate your bindings into chunks or just map your properties manually but sometimes using the setTimeout trick works. Hope this helps, Andreas
Image
It's been a while since I posted the last item. Just to cheer you up this is the newest song I created On the development side, I have been busy developing application form using ASP.NET controls, Knockout and jQuery. It has been fun leveraging both client and server side technologies so feel free to ask any questions in relation to those areas. Regards, Andreas

CRM 2011 Kerberos Troubleshooting - Report Wizard FetchXml Related Issue

Hi all, Recently one of our clients had issue when running reports created through the report wizard. After some investigations, it turned out that the FetchXMLDataSource is having some connection issue with an error log recorded something like:  A call to SSPI failed, see inner exception. This is surely a kerberos authentication issue. After a few good hours reading documentations on how to set up proper kerberos for CRM 2011, I managed to get all working nicely. I summarised all what I've done so that it may help you down the track: Check the CRMAppPool service account whether you are using NetworkService or a domain account. The best practice is to use custom domain account (separate from your CRM admin account as well). In my case I have something like domain\CRM2011APP. If you set this up during installation it should at least be in the PrivUserGroup and PrivSqlServerGroup as well. Open your AD manager and check if that account has kerberos delegation enabled (On de...

Knockout and SharePoint - Simple Example

Image
Hi All, As you all know, client side technology is powerful and I am a fan of it. Apart from being fast and no postback is required, it is relatively easy to develop compared to hefty server side code. However you should keep in mind that your code can be easily tracked and downloaded so if you have sensitive information and logic that needs to be secured then you need to use server side code :) You can do hybrid application though and that is probably the best way to go. In this example I will show you how easy to get the data out of SharePoint list and display it with a little user interactivity. This web part consists of a user control and it basically displays a land mass comparison in boxes. Most of the times people do not realize how big WA is in comparison to their own country and when they come here they find out that they need 1-2 days to get to the other region. End result will look like this: We will be using: 1. jQuery  +  Knockout 2.1.0  fo...