The SharePoint Customization Hippocratic Oath

I love this post by Woody Windschman:

First, Do No Harm

Use the Product : Don't customize where SharePoint already does what you need.

Do it with Style : Don't build a Master Page when a CSS theme will suffice.

Take the Data View : Don't build a binary web part when a Data View or Content Editor can do the job just as easily.

Master It : When you do need to make major changes to the layout of your pages, customize the Master, but don't throw the baby out with the bath water.

Feature it at Staples : Don't build a Site Definition when you can achieve your goals with Features and Feature Stapling.

The Definition of Success
: If you must use a Site Definition, understand the ramifications.

Original post: http://www.thesanitypoint.com/archive/2 … -harm.aspx

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Bulk Convert DOC to DOCX

Microsoft has a bulk conversion utility that can convert multiple DOC files to DOCX files. This blog post presents very basic information on its use. This utility has been around for a while, but a fair number of people don

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

SharePoint enums and Webservices

When you get an xml result from the SharePoint webservices, these results are Strings, but in the SharePoint dll these results are availbale in an enum.

private SPFieldType GetFielType(XElement xElement) {
return (SPFieldType)Enum.Parse(typeof(SPFieldType), GetAttribute(xElement, AttributesWeb.Type));
}

I created some wrapper classes that makes coding easier against SharePoint Webservices, in time I will publish more of these:

these can be found here

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

_x0020_

Whatever xml encoding SharePoint sends can be decoded using the code below from System.Xml.

XmlConvert.DecodeName(“My_x0020_Name”);

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

BaseType Element

Every list in a Web site based on SharePoint Team Services from Microsoft inherits its schema from a base type. The BaseType element defines the default schema (for example, the fields) that all lists derived from the base type must contain.

Unique ID for the base type. The following values are possible for built-in base types:

0 = GenericList
1 = DocumentLibrary
2 = BaseType Unused
3 = DiscussionBoard
4 = Survey
5 = Issue
-1 = UnspecifiedBaseType

Complete list:

http://abstractspaces.wordpress.com/200 … nce-sheet/

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

SharePoint Impersonation

SharePoint code runs in the context the user activates certain code. When this user doesn't have sufficient priviliges to update an item, you run in a security exception.

Use RunWithElevatedPrivileges in order to run code as administrator privileges.


SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(this.Site.Url))
{
using (SPWeb web = site.OpenWeb(this.Web.ID))
{
web.AllowUnsafeUpdates = true;

//ACTIONS

web.AllowUnsafeUpdates = false;
}
}
});

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)