A Practical Guide to SharePoint 2013

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

Thursday, March 12, 2009

Explorer view in big libraries does not load

Explorer view in big libraries, that have huge number of documents, does not load. It gives you following error:

After some time, you get the following network error:


Tuesday, March 10, 2009

Error: File not found

File not found
I got this error second time in two months so I thought I would share my experience with the readers. As you may know, there could be several reasons for this error. If you google internet for this specific SharePoint error, you will find a couple of posts discussing the issue:
As you will notice in the above two posts, in both cases the cause of the error was different. In one case, it was related to web part. In other case, it was related to a misplaced CSS file. In my case, the problem was due to low disk space in system drive. Interesting? I checked IIS, sites were running. Checked DB! Databases were up! I created and tested a WSP on my server before the error appeared on my server. I retracted and deleted the WSP although I was sure it had nothing to do with the error. Then I noticed, my server was performing slow. Checked processes, they were ok. Checked for virus. No virus found! In the end, I noticed the server was slow because it had run out of space on system drive. I freed up some space and SharePoint sites started working. I thought I would share this with my blog readers. If you see this error next time, don't forget to check space on your system drive.

10 Best Practices For Building SharePoint Solutions

Some tips about writing testable code and deploying SharePoint solutions!

MVP Renewed for another year!

Just got an email from Microsoft that my MVP award has been renewed for another year.  Congrats to everyone who got renewed and to all the new MVPs!

Saturday, February 21, 2009

InfoPath Tip: Managing older versions


InfoPath Tip: Managing older versions
Here is a small tip to manage older versions of InfoPath forms. This is a very simple tip and the solution is available out-of-the-box but unfortunately, InfoPath developers usually ignore this built-in feature and face problems after deploying the updated forms. You may have noticed that you get "Schema validation errors found" when opening an updated form. In fact, the form fails to open and it is difficult to locate the data sources that cause the problem. This question is asked frequently in the forums where users ask for solutions to fix the problem. Some users manually upgrade the XML of existing forms to make them compatible with the new template.

In the "Form Options", inside "Versioning" category, there is an option to manage version upgrades.



The drop down has three options:

> Do nothing (existing forms might not work properly)
> Automatically upgrade existing forms
> Use custom event

By default, the first option "Do nothing ..." is selected. Select the second option "Automatically upgrade existing forms" and save changes. Publish your form. This will automatically upgrade the existing forms and you won't have to update their XML manually which can be quite cumbersome if the library contains hundreds or thousands of forms which is a common scenario in big companies. Some times, it is necessary to keep the existing forms as they are and upgrade them manually if need be but that is rare.

User can also take advantage of "Use custom event" option. This will add an event handler to the form where you can add your own custom code but this will be useful only if you know what changes you had made in the form. You can read more about it at http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.formevents.versionupgrade.aspx.

For example, you can check the version number of the form being opened and the version number of the template and if the form's version is older than the template's version then you can use custom code to handle the situation. For example, the following will give you the version numbers:

public void FormEvents_VersionUpgrade(object sender, VersionUpgradeEventArgs e)
{
string formVersion = e.DocumentVersion;
string templateVersion = e.FormTemplateVersion;

//comparison code here
//if versions are different then do something


}

Another option is to add checks in the form using code. Suppose you added a new data source in the form. This data source will not be available in the forms based on the older template. You can check for the existence of the data source/node programmatically and handle business logic accordingly. For example, here is some sample code:

XPathNavigator node = this.CreateNavigator().SelectSingleNode("/my:myFields/my:newNode", this.NamespaceManager);
if (node != null) //if this node exists
{
   //Logic 1
}
else
{
   //Logic 2
}

node = null;

You simplly check the existence of the data source by comparing it to "null". If it's not null (node exists), run new logic for the new form else skip the new logic to keep the old forms intact.