Index

Avoid $ as jQuery reference

Avoid global $-var as it conflict with assert picker and cmssitemanager.js.

Avoid custom logging

Do not use custom logging tools. It is required web.config changes or affects to solution security.

Avoid SPWeb.Properties usage

It’s important to note that the methods of SPWeb that handle properties, reflect upon the SPWeb.AllProperties property and not on the SPWeb.Properties property.

ConfigurationManager is used

Avoid using System.Configuration.ConfigurationManager and System.Web.Configuration.WebConfigurationManager classes as well as store any configurations in the web.config files. It requires web.config changes which might affect farm stability, supportability, maintainability and migration.

Consider Secure Store Service usage

At some point, it is better to use Secure Store Provider to store credentials/connection strins intead of saving them into web.config, property bags or lists.

DirectorySearcher is used

Do not use DirectorySearcher class to query ActiveDirectory.

EntityEditor.Entities is used

It is not recommended to use the Entities property to get the selected entities, because using this sometimes causes unexpected behavior.

General exception is suppressed

The exception itself should not be ignored because it can be affected to regular program flow.

gProcessingId parameter is missed for SPSite.AddWorkItem()

Specify gProcessingId parameter for SPSite.AddWorkItem() as Guid.Empty.

Inappropriate PublishingWeb.GetPublishingPages() usage

There are two methods GetPublishingPages() and GetPublishingPages(uint rowLimit).

Inappropriate SPList collection usage

List name is culture specific string or could be changed later

Inappropriate taxonomy collection usage

Avoid string based index call on taxonomy collection because it could be localized or case -sensitive.

Inappropriate usage of SPContentType.Fields

SPContentType contains two collections, Fields (of type SPFieldCollection) and FieldLinks (of type SPFieldLinkCollection). Even if the object model appears to support addition or deletion of fields using the Fields collection, an exception is thrown if you try to do so.

Incorrect SPView usage

SPList.DefaultView and SPList.Views[] properties return a new SPView instance with every call. To handle a single instance you need to retrieve the SPView object and modify it directly.

jQuery(document).ready in CSharp code

Due specific SharePoint client side initialization life cycle, it is recommended to avoid using $(document).ready and windows.load = function() { …};.

Login