Skip to main content

Posts

Showing posts from May, 2009

Customizing Alert Notifications and Alert Templates in WSS 3.0

Alerts are an e-mail subscription notification service in WSS 3.0. Users can create alerts to be notified of changes to list items (item level alert), documents, lists (list level alert), or document libraries. Alerts in Windows SharePoint Services 3.0 are quite flexible; when you create an alert you have options such as when to be notified and what kind of changes will trigger the alert. Alerts can be managed by users and administrators and customized by developers. After an alert has been created, changes that fit the criteria specified in the alert are recorded in an event log. Alerts are generated by a timer job that reads the event log, formats the alert email using an alert template, and then sends that email out to the user. Alert templates are stored in Alerttemplates.xml. Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS Alerttemplates.xml defines the format, contents, and properties used to create alert messages from each list type in Windo...

UNHIDE SHAREPOINT FIELD

I am writing this as a reminder for myself and for the sake of those that might need it. You come across fields in SharePoint that only shows while using CAML query builder but wouldn't show in the UI. These fields are system generated as part of the content type or library. To show them properly, you need to change a property called cantogglehidden which by default is readonly. SPSite site = new SPSite("http://moss01"); SPWeb web = site.RootWeb; web.AllowUnsafeUpdates = true; SPField spfield = web.Lists["Accounts"].Fields["Document Type"]; Type type = spfield.GetType(); MethodInfo miinfo = type.GetMethod("SetFieldBoolValue", BindingFlags.NonPublic | BindingFlags.Instance); miinfo.Invoke(spfield, new object[] { "CanToggleHidden", true }); spfield.Hidden = false; spfield.Update(); QED

SPDisposeCheck

Have you checked your assemblies before final deployment. It is the best practice to make sure that your code is safe for deployment with no memory leak. A new tool called SPDisposeCheck is now available to help you in checking and ensures you build good code. Without disposing SharePoint objects, you are subject to memory problems on the deployment server. This tool however recursively checks through your code and reports. You can check it out here. The SPDisposeCheck tool can be downloaded here .