0

Right now my code gets the URL from my SPSite but I only want to get the Title

var url = portalUrl.Text;
if (SPSite.Exists(new Uri(url)))
{
    using (SPSite oSiteCollection = new SPSite(url))
    {

        SPSiteCollection collWebsite = oSiteCollection.WebApplication.Sites;


        foreach (SPSite site in collWebsite)
        {
            listboxLogging.Items.Add(SPEncode.HtmlEncode(site + Environment.NewLine));
        }


    }
}
1

Only SPWeb has a title. You can get that from the context.

SPContext.Current.Web.Title
1
  • With his code, SPSite.RootWeb.Title – Choggo Feb 4 '15 at 15:18

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.