VS Web Deployment Package – Windows Server 2008

If you have all (obvious) required prerequisites installed IIS – ASP.NET, correct .NET Framework version and have correct permissions to deploy as a admin and receive the msi message “Installation Incomplete – The installer was interrupted… blah blah” try the following:

Open Server Manager > Roles > Web Server (IIS) > Add Roles Services

Select IIS 6 Management Compatability and install

Re-run Web Deployment Package and it should all work.

SharePoint 2010 AllWebs SecurityException

I recently came across an issue with AllWebs that threw a SecurityException in certain environments and needed a way to traverse all subsites to locate based on a specific match. This is a simplified version of the solution I came up with, I hope it helps someone else out:

string title = "MySiteTitle";
Guid siteId = SPContext.Current.Site.ID;
 
using (SPSite site = new SPSite(siteId))
{
    SPWeb web = GetSubWeb(site.OpenWeb(), title);
 
    if (web != null)
    {
        // Do Stuff
    }
}


private static SPWeb GetSubWeb(SPWeb root, string title)
{
    SPWeb foundWeb = null;
 
    SPWebCollection subWebs = root.GetSubwebsForCurrentUser();
 
    foreach (SPWeb web in subWebs)
    {
        if (web.Title == title)
        {
            foundWeb = web;
            break;
        }
        else
        {
            foundWeb = GetSubWeb(web, webId);
            if (foundWeb != null)
            {
                break;
            }
        }
    }
 
    return foundWeb;
}