A Practical Guide to SharePoint 2013

A Practical Guide to SharePoint 2013
A Practical Guide to SharePoint 2013 - Book by Saifullah Shafiq

Monday, November 17, 2008

InfoPathMVP Award Program Blog

The following blog shares some of the inspiring activities of MVPs around the globe:

Wednesday, November 12, 2008

InfoPath Error: Cannot cast 'DataConnections[]' (which has an actual type of .....

(FileSubmitConnection)DataConnections["Submit"]              Cannot cast 'DataConnections["Submit"]' (which has an actual type of 'Microsoft.Office.InfoPath.Server.DocumentLifetime.SubmitToHostConnectionHost') to 'Microsoft.Office.InfoPath.FileSubmitConnection'            Microsoft.Office.InfoPath.FileSubmitConnection
Have you seen this error before? It occurs if you try to submit form to a host but you use data connection of type "FileSubmitConnection". Here is the code:
FileSubmitConnection  connection = (FileSubmitConnection) (DataConnections[“Submit”]);
You can submit to the following locations:
1. Web service
2. Forms library
3. As an email message
4. To the hosting environment
The code above is meant for submitting to a forms library. In workflow forms, people submit task forms to a hosting environment and they forget to change the data connection type, that is when they get this error. It is important you use correct casting when submitting the form. To submit a form (task form) to hosting environment, you should use following code:
SubmitToHostConnection  connection = (SubmitToHostConnection) (DataConnections[“Submit”]);

Sunday, November 9, 2008

Preserve code blocks are not supported in browser-enabled InfoPath forms

Preserve code blocks are not supported in browser-enabled InfoPath forms

The text on the button can be changed dynamically in InfoPath 2007. If you bind the button to a data source and then change the value of the data source using rules, the value of the button text will change dynamically. Can this be done programmatically? Yes! You can modify the XSL of the view to control the text of the button but the problem is this has to be done manually and when you load the view in editor, all your changes are lost. To preserve your changes, you must use "xd:preserve" but the problem is "xd:preserve" or "Preserve Code Block" is not supported in browser-enabled InfoPath forms. It will work in InfoPath client though. If you have no clue what I am talking about, then read the following article:

Using Custom XSLT in InfoPath Form Templates

This question is usually asked in forums where people ask if they can change the button text/label programmatically. As I mentioned above, the answer is "Yes" but it will be very difficult to manage the XSL if you cannot preserve your changes. Every time you want to publish your form, you will have to re-do your changes in the XSL. The following MSDN article clearly mentions that "xd:preserve" blocks are not supported in Forms services:

Creating InfoPath Form Templates That Work With Forms Services

After changing the XSL, you will see a red box on your form in the design mode with text "Preserve Code Block".

If you have enabled browser compatibility in your form, then the design checker will show the error:

"Preserve code blocks (xd:preserve) are not supported".

Click the error message, javascript pop-up will appear:

If you still want to go ahead and make changes in your XSL, remove the template block and save the changes outside InfoPath. Publish the form and your changes will work fine. In next article, I will show you how you can control the button text dynamically. It should have been other way round. I should have written about controlling button text first but anyway, doesn't make any difference.

Thursday, November 6, 2008

Wednesday, November 5, 2008

New Ajax book

New Ajax book is available November 12: Developing Service-Oriented AJAX Applications on the Microsoftr Platform

MS patterns and practices releases SharePoint Guidance

Codeplex site: www.codeplex.com/spg
This guidance helps architects and developers design, build, test, deploy and upgrade SharePoint intranet applications.

SharePoint for developers Track on MyRampUp.com

Ramp Up program has launched SharePoint for developers track today. 
Ramp Up is a free, online, community-based program that can help users save time in learning Microsoft technology. The easy-to-access content (provided by subject-matter gurus) is specifically tailored to the Ramp Up program, and offered in a variety of forms (whitepaper, v-lab, codecast and slidecast). This SharePoint track, along with the other currently offered tracks (eg, Visual Studio 2008), teaches the important skills in a guided path, making the learning process easier and more efficient. Currently, there are no assessments in the program, so it's quicker than ever to graduate and receive the reward (25% off on certification and 50% off on e-Learning - only for graduates of Ramp Up).