feedburner

Subscribe

View Venkat Varkala\

Code Acceptance checklist for Custom MOSS Solutions

Labels:

Microsoft has a good checklist for code acceptance for developing Custom MOSS solutions. Below are some points with useful links

  • You avoid using AllowUnsafeUpdates. You use ValidateFormDigest() and, if necessary, use elevated privileges to interact with SharePoint objects. In cases where AllowUnsafeUpdates must be used, you ensure that AllowUnsafeUpdates is set to False in your try-catch-finally block, or you use a Dispose() method (as required by the IDisposable interface) to avoid security issues.What you need to know about AllowUnsafeUpdates (Part 1) What you need to know about AllowUnsafeUpdates (Part 2)
  • When logging code, you use the Portal Log class to log the SharePoint Unified Logging Service (ULS) logs.Trace Log Example from Microsoft
  • When using the Count property of a SPListItemCollection, you only call it once and then store it in a variable that you can refer to when looping. You do not call it inside a loop.

Configuring SPHierarchyDataSourceControl to show all sites from Root of Site Collection

Labels:

SPTreeView Control by default shows all the lists, document libraries & Sites in the Current Context (Web), if you want to show only the Sites from the Root of your sitecollection. Open your master page using SharePoint Designer and find "SPHierarchyDataSourceControl" and update it to look like below element.

<SharePoint:SPHierarchyDataSourceControl runat="server" id="TreeViewDataSource"  IncludeDiscussionFolders="false" ShowDocLibChildren="false" ShowFolderChildren="false" ShowListChildren="false" RootWebId="INSERT YOUR ROOT WEB GUID HERE" />
 Make sure that you remove "RootContextObject" attribute, RootContextObject property value overrides "RootWebId" property.

SPTreeView : Could not bind to the 'EncodedName' property (specified by TextField) while data binding TreeView. Please check the Bindings fields.

Labels:

Recently when I tried customize "SPTreeView" I came accross below error

Could not bind to the 'EncodedName' property (specified by TextField) while data binding TreeView.  Please check the Bindings fields.
 The problem is I was trying to assign ID of "SiteMapDataSource" to SPTreeView Controls' "DataSourceId" property, when I updated the "DataSourceId" property to SPHierarchyDataSourceControl Control ID SPTreeView works fine.  

The original page layout could not be found, so the page was reattached to a different layout

Labels:

When I tried to re-attach a page to its pagelayout I get an SPD error message saying the page layout could not be found though the page layout exists.

I was not able to figure out what caused this problem but I was able to fix this issue by updating page layout URL manually.
  1. Make sure your page reattached (click Ok when SPD prompts page was reattached to different pagelayout)
  2. Using browser go to your Page Library
  3. From "Actions" menu select "Open with Windows Explorer"
  4. Copy the Page to local hard disk (Drag and Drop)
  5. Open the Page using WordPad (Page has special Characters) and find "" element and update the Path to your original PageLayout Path.
  6. Upload back to your SharePoint Pages Library

List of Microsoft Hot Fixes after Service Pack 1

Labels:

Installing Service Pack 1 broke Advanced Search webpart on my development environment.  Microsoft has a  hot fix for this. http://www.harbar.net/articles/postsp1.aspx has a nice list of post SP1 hot fixes along with their build numbers.

SharePoint Events and Error Reference

Labels:

http://technet.microsoft.com/en-us/library/cc721660.aspx has the list of most common MOSS Events and Error Messages.