DCSIMG
WSS - David Birin's blog

Browse by Tags

SharePoint – Events are duplicated when using templates
I encountered a strange behavior in SharePoint, this phenomenon happens when you create an event handler and attach it to a list template (for example, a document library) using a web-site level feature. If you save the list as template, the event handler reference is saved inside the list template (STP file) and when you create an instance using the template it can cause the following problems: The event handler will be activated automatically on a web site where the feature is not enabled. If the...
SharePoint – Add a SPField to all the content types in a SPList
I found out (another) strange behavior of SharePoint, I tried to add a field (a column) to a list which contain more than one content type using the following code (the new field name is “New Field”) : using (SPSite currentSite = new SPSite( "http://moss" )) { using (SPWeb currentWeb = currentSite.OpenWeb()) { SPList currentList = currentWeb.Lists[ "DocLib" ]; SPField newField = currentList.Fields.CreateNewField(SPFieldType.Text.ToString(), "New Field" ); currentList...
How to get the context item in Workflow activity (SharePoint)
Although it seems a fairly simple and commonly used task to get the context item (the item that the workflow is currently working on), it took me and Dor Rotman some digging to find the correct way to do it. The first step is to add 3 properties to your activity, these properties have fixed names, I guess that in runtime the activity is loaded using reflection and the context variables are placed into these properties. To simply add a property in a workflow activity, you can use the code snippet...