March 20, 2007

MOSS: Connect to Outlook missing from my custom tasks list

Problem:
I created a custom tasks list, now "Connect to Outlook" option is missing in Actions menu, Client Integration is enabled.

Workaround:
Your custom task list must have same type as the original MOSS list, i.e., your custom Task list must be of type 107. This doesn't seem to be a requirement with DocLibs, however.

March 19, 2007

MOSS: Creating subsites in site definition

Well, not really, but by using a MOSS 2007 Features you can automatically create sites below the site user just created. Other way to create sites is to use Provisioning.

FeatureEventHandler:
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
    using(SPWeb web = properties.Feature.Parent as SPWeb)
    {
        // Check that subsites do not already exist
        if(web.Webs.Count == 0)
        {
            // Create subsites
            try
            {
                web.Webs.Add("", "SubSite1 Title", "", 1033, "", false, false);
                web.Webs.Add("", "SubSite2 Title", "", 1033, "", false, false);
                web.Webs.Add("", "SubSite3 Title", "", 1033, "", false, false);
            }
            catch(Exception e)
            {
                throw new SPException("Error when trying to create subsites. Error: " +
e.Message);
            }
        }
    }
}

Create new subsite Feature:

<feature id="7F4AA5EF-6A62-4a08-8565-DE39C02839E7"

title="Subsites"

description="Creates subsites for specific sites."

version="1.0.0.0"

hidden="TRUE"

scope="Web"

xmlns="http://schemas.microsoft.com/sharepoint/" receiverassembly="FeatureEventHandler,Version=1.0.0.0,Culture=neutral,PublicKeyToken=60a5c2355dc3549c"

receiverclass="Features.FeatureEventHandler">

</feature>