1

I`m making a windows application that analyse the SharePoint site.

In SPSite Level, I want to get Site Collection name.

Which means, I already got Site template name like this STS.

private string GetSiteTemplateName(SPSite site)
{
    string retValue = string.Empty;
    string webAppUrl = site.Url;

    using (SPSite sites = new SPSite(webAppUrl))
    {
        using (SPWeb web = sites.OpenWeb())
        {
            retValue = web.WebTemplate;
        }
    }

    return retValue;
}

But for end users, they don`t know about STS, So I try to change that lite this : Team Site

I try to find that, but I`m not sure how can I do that.

Does anybody know about this? Please help me.

1

Use SPSite.RootWeb.Title to get web title....

in your case it would be web.Title. I would have used below to get Title/Name of Site collection.

private string GetSiteTitle(SPSite site)
{
    return site.RootWeb.Title
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.