获取网站资源Get a site resource

命名空间:microsoft.graphNamespace: microsoft.graph

检索 [网站][]资源的属性和关系。网站 资源表示 SharePoint 中的团队网站。Retrieve properties and relationships for a site resource. A site resource represents a team site in SharePoint.

权限Permissions

要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

权限类型Permission type 权限(从最低特权到最高特权)Permissions (from least to most privileged)
委派(工作或学校帐户)Delegated (work or school account) Sites.Read.All、Sites.ReadWrite.AllSites.Read.All, Sites.ReadWrite.All
委派(个人 Microsoft 帐户)Delegated (personal Microsoft account) 不支持。Not supported.
应用程序Application Sites.Read.All、Sites.ReadWrite.AllSites.Read.All, Sites.ReadWrite.All

获取租户的根网站Get the tenant's root site

若要访问租户内的根 SharePoint 网站:To access the root SharePoint site within a tenant:

GET /sites/root
GET /sites/contoso.sharepoint.com

通过相对于服务器的 URL 访问网站Access a site by server-relative URL

如果你的服务器具有 网站 资源的相对于服务器的 URL,你可以构建请求,如下所示:If you have the server-relative URL for a site resource, you can construct a request as follows:

GET /sites/{hostname}:/{server-relative-path}

访问组团队网站Access a group team site

若要访问组的团队网站:To access the team site for a group:

GET /groups/{group-id}/sites/root

示例Example

请求Request

GET /sites/{site-id}

响应Response

HTTP/1.1 200 OK
Content-type: application/json

{
  "id": "contoso.sharepoint.com,2C712604-1370-44E7-A1F5-426573FDA80A,2D2244C3-251A-49EA-93A8-39E1C3A060FE",
  "displayName": "OneDrive Team Site",
  "name": "1drvteam",
  "createdDateTime": "2017-05-09T20:56:00Z",
  "lastModifiedDateTime": "2017-05-09T20:56:01Z",
  "webUrl": "https://contoso.sharepoint.com/teams/1drvteam"
}