PANVEGA’s Blog

DotNet Development, SharePoint Customizing, Silverlight, MS Infrastructure and other tips and tricks

Archive for the ‘Deployment’ Category

SharePoint Feature Activation Dependences

Posted by PANVEGA on September 7, 2009

A XML element that you can add to our FEATURE.XML is called, “ActivationDependencies”. When WSS activates a feature that defines activation dependencies, it automatically activates any dependent feature that has already been activated.

Here is an example of an activationdependence for the publishing feature.

Read the rest of this entry »

Posted in Deployment, MOSS, XML | Tagged: , , | Leave a Comment »

Using SPWebConfigModification within a Feature Receiver

Posted by PANVEGA on September 2, 2009

Sometimes when developing moduls for SharePoint you have to register these modules in your application web.config. You can easily do this by using the SPWebConfigModification class in combination with a feature receiver.

This class holds modifications that are made to the web.config.

Quite often I have to make some changes in the web.config files of the web applications where my solutions are to be deployed. Manifest.xml files of Sharepoint Solutions helps us with this task providing us with some easy ways to alter the web.config files, unfortunately, we are limited at registering safe controls and alter security policies which sometimes is not enough. Read the rest of this entry »

Posted in C#, Deployment, MasterPage, MOSS, Object Model | Tagged: , , , , | 1 Comment »

Deployment for a Custom SP PageLayout

Posted by PANVEGA on June 25, 2009

In this post I gonna explain in a few steps how to build a SharePoint Feature for a PageLayout. To do this, I needed to create a new page layout based on an existing layout, make this part of a feature and pull in all the bits and pieces necessary to deploy this as a feature.

First I copied a default PageLayout (Welcome Page) with a Fields from this Content Type.The Content Type Group is the default Page Layout. To do This opnen the _catalogs with the SP Designer. Now you have the basic aspx files you will modify and put back into SharePoint as a feature. Open the aspx page in an appropriate editor. Make the appropriate modifications and save the file.

Read the rest of this entry »

Posted in Deployment, MasterPage, MOSS, PageLayout, SPDesigner | Tagged: , , , , | 1 Comment »

Using ASP in JavaScript for URL Encoding in SharePoint fields

Posted by PANVEGA on February 3, 2009

In this post I want to show you how to rebuild the standard MyLinks –> Add to My Links for a custom MyLinks Control in Visual Studio and using ASP in JavaScript.

Active Server Pages exposes an object called ServerVariables, which is part of the Request object. This ServerVariables object allows the programmer to see many environment variables. You can use the ServerVariables along with IIS’s directory sercurity options to determine who is currently accessing your site. You can also grab the visitor’s IP address using the ServerVariables object. This article includes a question and answer from the Activer Server Pages mailing list, as well as an excerpt from the Visual InterDev 1.0 help files detailing all of the properties of the ServerVariables object.

https://panvega.wordpress.com/2008/02/24/different-way-how-to-customize-the-mylink-in-moss (4. How to develop your custom MyLink Control in Visual Studio.) Read the rest of this entry »

Posted in ASP.NET, C#, Delegate Controls, Deployment, DotNet, JavaScript, MOSS, My Links, My Site | Tagged: , , , , , , , | 2 Comments »

SharePoint Exception Handling and Logging

Posted by PANVEGA on January 21, 2009

Error and exception handling is very important in creating a robust and high quality system and more importantly for trouble shooting. Error and exception handling must be done correctly so that potential issues with the system can be diagnosed quickly.

The Basics

  • Always display a high level abstract message to the user when an error occurs or an exception is thrown rather than a low level exception message that the user will not understand. The low level specific error message should be written to the log file.
  • Check objects, values, properties etc before using them so that unexpected exceptions are not thrown.  For example
    • When obtaining an object always check the object is not null before using it.
    • Always check strings to make sure they are not empty or null i.e. String.IsNullOrEmpty(“aString”)
  • Never use try catch blocks to control the logic of your code, it is more efficient to use if/else statements and only throw exceptions when nothing else can be done.
  • When casting always check the object can be cast to the particular object. For example:

if(MyObject is String)

{

// Cast object your object

} Read the rest of this entry »

Posted in ASP.NET, C#, Deployment, DotNet, MOSS | Tagged: , , , | Leave a Comment »

Introduction in Custom WF Activities

Posted by PANVEGA on January 20, 2009

Microsoft Office SharePoint Designer 2007 allows non-developers to create custom workflows in a straightforward way by using the workflow designer it provides. During the process, the user “glues” together different activities that represent the steps for the workflow. There are numerous activities one can use and the list is extensible. Developers can use Microsoft Visual Studio 2005 to build additional activities and deploy them, so that they are available in Office SharePoint Designer 2007.

My example in the post extendes the default out of the box Activity in the SP Designer (Copy List item). In the default activity you can only copy an item in the same site. I added a new attribute DestinationListUrl which copies the select item from the root list by using the SP Object Model to the destination list in an other site collection.

copyitem

On Codeplex you find some useful custom SP Activities Read the rest of this entry »

Posted in Administration, C#, Deployment, DotNet, MOSS, Object Model, SPDesigner, Workflows, XML | Tagged: , , , , , , , , | Leave a Comment »

How to add a SPFeatureReceiver to a Custom ListInstance?

Posted by PANVEGA on January 19, 2009

In reference to my previous post about binding a Custom ContentType to a new ListInstance, I wanna solve this issues belowe with a SPFeatureReceiver class in Visual Studio.

https://panvega.wordpress.com/2009/01/19/how-to-bind-a-customcontenttype-to-a-listinstance-feature

https://panvega.wordpress.com/2008/11/05/how-to-develope-a-custom-sp-eventreceiver

First off the default view of your list does not contain those custom columns. When you select the item you will of course see all of your columns but they aren’t listed in the default view. Secondly the default content type for the list is still available to the user. In the case of a generic list the “Item” content type is still present. So when a user enters a new item they are able to select Item or your custom content type. This may not be desirable. Also if you are using the API to insert a new item into the list it will use the list’s default content type instead of the one you may be expecting. Once again this may not be desirable.

To overcome these restrictions we’re going to create a generic feature receiver that can be reused on any implementation using this technique. Read the rest of this entry »

Posted in C#, Custom Content Types, Deployment, DotNet, Event Receivers, MasterPage, MOSS, Object Model, Site Definition | Tagged: , , , , , , , , | Leave a Comment »

Adding a Webpart into a MasterPage with a Feature

Posted by PANVEGA on January 16, 2009

The best practise, when you want to add a Webpart into a MasterPage is using a Delegate Control with a Feature.  I wanted to add a Content Query Webpart into my Masterpage Page headline with a Custom Delegate Control.  Note!  You can not add a Webpart Zone into a MasterPage just static Webparts!  Many of the controls used on default.master are loaded using the Delegate Control. These include global links such as My Site/My Links and the publishing console. So using this approach, customizing the publishing console is a simple matter of providing a replacement .ascx and creating a feature as described here!

Why using a Delegate Control?

Using the concept of a delegate control, you can take any control that exists in Sharepoint today or your own custom creations and place them on a sharepoint page such that they override the existing control at whatever scope you desire (individual site, site collection or farm) and yet require no recoding of the page(s) itself.  In previous Sharepoint versions, this involvded either customizing the pages one by one and/or creating a whole new site defintion. With the concept of delegate controls in Sharepoint 2007, its a handful of lines of code and its far more powerful.

On every Sharepoint deployment I have ever done, it has been requested that the search box be modified, either comsmetically or functionally.

Here is a short example:

<SharePoint:DelegateControl runat=”server”
ControlId=”SmallSearchInputBox”/>

The delegate control tag, the best I can deduce, does a lookup of the features on the site that will share the controlID value of “SmallSearchInputBox”. Out of the box, there is only 1 of these declared, in the feature called ContentLightup.

What you can do (as documented in the SDK) is create your own feature that uses this same controlID but refers to a different underlyling .ascx (custom control) file. The delegate control feature will then check the list of all controls with this same ID and use the one that has the lowest sequence number as declared in the <control> tag as part of another xml file in the feature

<!– using a sequence number LOWER than default of 100 so our custom control gets loaded –>

<Control
Id=”SmallSearchInputBox”
Sequence=”61″
Controlsrc=”~/_controltemplates/searcharea.ascx” mce_src=”~/_controltemplates/searcharea.ascx”>
</Control>

Only thing to note here at this stage is the ControlId attribute – the Feature we create will use this to substitute the real user/server control.

Read the rest of this entry »

Posted in Delegate Controls, Deployment, MasterPage, MOSS, WebParts | Tagged: , , , , | Leave a Comment »

Custom Content Type without Title Field

Posted by PANVEGA on January 14, 2009

In my previous post https://panvega.wordpress.com/2009/01/14/how-to-create-a-custom-content-type-with-a-feature I explained how to build a Custom Content Type.

In this post I wanna show how to remove the default Title field with it´s Item Content Type from your Custom Content Type. By default you can not delete this special kind of field from your list. In addition sometimes it is annoying having this irritating default field. Read the rest of this entry »

Posted in Custom Content Types, Deployment, MOSS, XML | Tagged: , , , | 1 Comment »

How to create a Custom Content Type with a feature

Posted by PANVEGA on January 14, 2009

In this post I am gonna show you in only a few steps and a short introduction how easy it is to create a Custom Content Type  for a SP Feature Deployment.

Introduction:

A Content Type is a SharePoint object that is closely associated to List item (objects that inherit from SPItem), these objects host meta-data information describing the item it’s associated with. In Windows SharePoint Services, a content type is a reusable collection of settings that are applied to a certain category of content. Learn how to build a custom content type by using Microsoft Visual Studio 2005 Extensions for Windows SharePoint Services 3.0.

A Content Type is a definition of the metadata and behavior of a SharePoint list item. In short, it specifies a type of list item based on:

  • The columns that compose the list item;
  • The document template used to create a new item (if it’s a document content type);
  • The information management policies associated with it;
  • The workflows associated with it. Read the rest of this entry »

Posted in Custom Content Types, Deployment, MOSS, XML | Tagged: , , , | 2 Comments »

Introduction in Feature Stapling

Posted by PANVEGA on January 7, 2009

The focus of this article is going to be on a concept called Feature Stapling. Most, if not all, SharePoint developers know that Microsoft frowns on modifications to the “Microsoft” owned files that support SharePoint. If you modify these files you run the risk of your changes being broken with the installation of a service pack or hot fix.

Feature Stapling allows you to create a feature and then associate it with any site definition without ever touching the site definition files themselves. The Feature Stapling applies to all new instances of sites that use a given site definition, without modifying the site definition or creating code routines to activate the Feature on each site.  Your feature will be executed when the site is being provisioned. Read the rest of this entry »

Posted in Deployment, MOSS, Site Definition | Tagged: , | Leave a Comment »

Deploy a custom Webservice into the SP ISAPI (_vti_bin) filder

Posted by PANVEGA on November 19, 2008

In this article I’ll cover how make a Content Deployment of a custum WebService (.asmx/.disco/.wsdl) to the ISAPI Folder. The dll is going to be deplyed into the WSS bin folder. For some procedures like, for example, adding the web service as a reference in a visual studio project, the discovery (.disco) and wsdl files are required.

read more about deploying inti the bin folder rather GAC in one of my posts Read the rest of this entry »

Posted in Deployment, MOSS, WebServices | Tagged: , | Leave a Comment »