Feature dependencies

When declaring a feature, you can add an <ActivationDependencies> section in your feature.xml. Here you can list the features your feature is depending on.

According to the documentation on activation dependencies (http://msdn.microsoft.com/en-us/library/aa543162.aspx), the dependant features get automatically activated if they are in the same scope: If a Feature is dependent on another Feature at the same scope, and the second Feature is not activated when the first one is activated, Windows SharePoint Services activates the second Feature.”

This is incorrect.

The second feature is activated automatically only if it is hidden!

Advertisements

InfoPath forms as features

I recently found an article describing how you can deploy administrator-approved InfoPath form templates using a feature.

http://blogs.infosupport.com/blogs/porint/archive/2007/04/24/How-to-deploy-an-admin-approved-form-template-using-the-feature-framework.aspx

Normally, you enter Central Administration and upload the form template from there, but this might not be desirable if you want to deploy “everything” from a WSP.

Creating Folders in a Document Library

Creating a new folder in a document library in SharePoint using the object model is not entirely logical.

You can’t use the Add method on the SubFolder collection (list.RootFolder.SubFolders). It will add the folder, but it will not be visible.

What you have to do is:

SPListItem newFolder = list.Items.Add("", SPFileSystemObjectType.Folder, "foldername");
newFolder.Update();

So what you actually do is to create a new list item of type Folder.

Information gotten from http://www.sharepointblogs.com/stevekay72/archive/2007/08/16/create-sub-folders-in-lists-programmatically.aspx