11 Common Mistakes Made In Sharepoint

Introduction

SharePoint - the buzz word for web portal that is browser based and drives towards effective management of data with ease. Also termed as one of the effective collaborative tools helping offices of all sizes to share the information effectively and manage day-day office processes through elegant workflows.

This article outlines few of the common mistakes encountered when working with SharePoint and Sharepoint solutions.

CAML Queries Don't Apply The Filters

CAML syntax is widely used to query the Document Library and the workflow. CAML Stands for "Collaborative Application Markup Language" and is XML-based. The Microsoft SharePoint assembly provides the SPQuery object that helps you query using the SharePoint Object Model.

The Query property of the SpQuery object does not need the <QUERY> tag in the Query. This causes the filters not to be applied. Remove the Query tags and the filters shall be applied with the Query.

Also, a good practice is to use the "ViewFields" property to retrieve only required fields from the Query. You can specify these using the ViewFields property of the Query Object. A sample snippet is as shown below:

oQuery.Query.ViewFields = "<FieldRef Name='Age' />";

Dreaded Error

First thing that strikes is the Unknown error in the SharePoint Page. This is known at times as the dreaded message. A lot of effective mechanisms to tackle this problem are provided on the web. Nevertheless, a quick mention of the easiest step would be worthless.

SharePoint does the job of hiding the exact error message from the .NET framework, thereby answering the concerns of security. However, the stack trace that is secured through the default behavior of the SharePoint is the vital need for the solution to such unknown errors.

For a developer to figure out the stack trace for an error, all the user has to do is to turn off the custom error in the web configuration file. In the Web configuration file of the site, look for the SafeMode tag. Under this tag look for the CallStack attribute. Set it to true to enable the Call Stack.

<SafeMode CallStack="true">

Additionally, look for the customErrors node and change the mode attribute value to Off

<customErrors mode="Off">

After changing these two values in the web configuration file, safe the web.config file and run your application. Ensure that you do these in your production environment only to figure out the actual error and then do not forget to toggle the values of the CallStack and the mode attributes of the SafeMode and the CustomErrors tags respectively. If you fail to do this, you might be compromising the security of the application.

These errors typically occur when you don't possess the right level of permissions to create sites OR add documents to a library.

Strange Errors After A Config Change

Strange errors can appear after a configuration change to the SharePoint application. This typically happens when you make changes to the "Alternate Access Mappings" or any other config changes. Timer jobs also fail to complete successfully at times.

Clear the SharePoint Configuration Cache in such cases.

SPLISTITEM Does Not Update The Object Properties

When we try to set values for SpListItem properties with the help of an Indexer, the values are not updated. The right way of doing this is to use the SpListItem object itself.

How To Effectively Delete A File From The Document Library

The easiest way to effectively delete a file from the document library would be to set the Expiration for the Site Creation Policy. Additionally, you would have to set the Retention period. The last step would be to attach the workflow to the list.

Programmatically, one would use the SPQuery class to query for selected files/all files and send us a date/volume. Although one would use this method to have a greater control over the document library.

ACCESS DENIED Message When One Tries To SET QUOTA From An SPSite

This error is encountered when one tries to set the Quote for a site from code-behind. Set the Quote to a higher value and do not forget to turn the AllowUnsafeUpdates property of the Web to true. Needless to say, you would have to turn this off after setting the Quota.

A Web Part Or Web Form Control On The Web Part Page Cannot Be Displayed.

The above said error occurs when we do not specify the Assembly information correctly in the configuration file. This typically includes incorrect name of the assembly, version, public key token or the TypeName.

TIPS

Configure Single Sign On In Sharepoint 2007

The Single Sign on systems are used to consolidate the multiple logins usage in a system. To prevent the usage of the multiple logins and configure Single Sign On in SharePoint server 2007, do the following.

Navigate to the Central Administration.

Choose Operations.

Select the Section titled, "Security Configuration" and choose "Manage Settings for Single Sign-On".

Choose Manage Server Settings under the window that appears

Specify the single sign-on Administrator account in the Account Name box.

Generate Emails From A Sharepoint List

Third party providers like the SharePoint Workflow Extensions from nSoftware allow you to generate the emails from the SharePoint list.

Conclusion

I hope you have found this article useful and that you can avoid some of these common Sharepoint programming mistakes.