April 2008 Entries
Microsoft.SharePoint.Utilities namespace [1] contains many useful classes such as SPUtility, SPEncode, SPUrlUtility, etc. As you can imagine, these classes contain many useful utility methods which can save developers lots of time as well as many line of code. In this article, I will introduce two methods in the SPUtility class as a starter. Until I update this article later, please take a look at the SharePoint SDK to see what kind of utility classes and methods the Microsoft.SharePoint.Utilities namespace contains.
SPUtility Class
Namespace: Microsoft.SharePoint.Utilities
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
SPUtility.CreateISO8601DateTimeFromSystemDateTime
Description
Converts a system DateTime value to ISO8601 DateTime format (yyyy-mm-ddThh:mm:ssZ).
User Scenario
When you need to use...
This is the list of steps to follow for troubleshooting general SharePoint issues.
1. Turn on the debug flag from SharePoint web.config
Note: Enabling debugging is not recommended on a production environment.
a. Locate the SharePoint web.config file which is typically located under one of the virtual directories in C:\Inetpub\wwwroot\wss\VirtualDirectories.
b. Make a backup of the web.config just in case.
c. Open the SharePoint web.config using a Visual Studio or a text editor such as notepad.
d. Find “CallStack”
e. Change the value of CallStack to “true”
f. Find “CustomErrors”
g. Change the value of CustomErrors mode to ”off”
h. Save the web.config.
...
I came across couple of questions from Internet about how to programmatically create a Gannt view on a custom SharePoint list. So, here is an answer to these questions.
1. First of all, create a custom list from a SharePoint UI.
2. On the menu of the newly created custom list, click Settings->Create Column.
3. Create a column for Start Date with "Date and Time" type with Date Only as a format (see the picture below). The column name doesn't need to be exactly same.
4. Create a column for End Date with "Date and Time" type with Date Olnly as a format.
5.Create...
SharePoint deployment is an important topic. I'll continue to update this article to augment any missing points. So, please visit this page once in a while. There are two types of SharePoint deployment. One is Feature deployment based on SharePoint solution packages, aka wsp files. The other is content deployment based on SharePoint Content Deployment.
Featured deployment based on SharePoint Solution Packages
For now, I'll skip explaining how to create a SharePoint solution package. Instead of reinventing wheels, you may take a look at tools which automatically generate wsp files.
Here are a few general tips on creating SharePoint solution packages.
Create multiple SharePoint...
I found several questions on the Internet about being unable to use MenuItemTemplate.ClientOnClickUsingPostBackEvent on a custom web part with SPGridView including this blog [1] and this post [2]. Being intrigued, I tried several approaches, and I could not make the ClientOnClickUsingPostBackEvent either. Instead, I found a workaround which should behave just like the ClientOnClickUsingPostBackEvent.
The solution is to use __doPostBack plus this.UniqueID inside a custom web part uses IPostBackEventHandler. Here is a code snippet:
displayInvoices = new MenuItemTemplate("Display Invoices", "/_layouts/images/invoice.gif");
displayInvoices.ClientOnClickScript = "__doPostBack('" + this.UniqueID + "','%EDIT%')";
Please ping me if you need a full source code. Then I'll update this article and upload...