如何使用C#在SPSite级别获取网站集名称(或标题) [英] How can I get Site Collection name(or title) in SPSite level using C#

查看:90
本文介绍了如何使用C#在SPSite级别获取网站集名称(或标题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我是SharePoint的新手,现在我正在尝试制作一个Winform应用程序,用于分析SharePoint网站的b
$
。我的应用程序是这样的。



1.在文本框中键入目标站点URL并单击按钮

2.分析站点(Web应用程序) ,内容数据库,网站集,网站,列表)

3.在每个DataGridView中显示结果



在网站集级别,我有一个问题,我怎样才能获得网站集名称(或标题)?¥b $ b $
SPWeb.Title是否相同?



请帮助我,我等你的建议.....

Hello, I am a newbie in SharePoint, and now I`m trying to make a Winform application that analyse

the SharePoint site. My application works like this.

1. Type target site url in text box and click button
2. Analyze the Sites( web application, content database, site collection, web, list)
3. Show the result in each DataGridView

And in Site Collection level, I have a question, is How can I get Site Collection Name(or a title)??

Is it same in SPWeb.Title?

Please help me, I`m waiting your advice.....

推荐答案

我们可以使用
SPSite.PortalName
以满足您的需求和代码如下:

We can use SPSite.PortalName to achieve your needs and the code as below:

SPSite site= new SPSite("siteURL");
string siteTitle = site.PortalName;

我们还可以使用RootWeb(网站集)标题和代码如下:

And We also can use RootWeb(site collection) title and the code as below:

SPSite site= new SPSite("siteURL");
SPWeb rootWeb = site.RootWeb;
string title = rootWeb.Title;

最好的问候,

Andy Wu


这篇关于如何使用C#在SPSite级别获取网站集名称(或标题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆