【问题标题】:What is Tenant in Office 365?Office 365 中的租户是什么?
【发布时间】:2020-01-04 04:02:13
【问题描述】:

我是 Office 365 和 SharePoint 的新手,在尝试使用 .NET 中的 CSOM 创建 SharePoint 网站时,我使用了租户,例如 (var tenant = new Tenant(clientContext);) 有人可以解释一下“租客”到底是什么,在这里有什么用处。当我搜索它时,我了解到每个公司唯一的租户 ID 之类的东西,但是 CSOM 中的租户 ID 和租户是不同的,对吧?还有什么是ClientContext?在我的代码中,我使用了 ClientContext 和 Tenant 来创建 SharePoint 网站。

using System;
using System.Security;
using Microsoft.Online.SharePoint.TenantAdministration;
using Microsoft.SharePoint.Client;
namespace CreateSiteCollections
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Program Started!");
            //Opens the Admin URL
            using(ClientContext tenantContext=new ClientContext("https://developer19-admin.sharepoint.com/"))
            {
                //Authenticating with Tenant Admin
                SecureString passWord = new SecureString();
                foreach (char c in "passCode1".ToCharArray())
                    passWord.AppendChar(c);
                tenantContext.Credentials = new SharePointOnlineCredentials("kailash@developer19.onmicrosoft.com", passWord);

                var tenant = new Tenant(tenantContext);

                //Properties
                var siteCreationProperties = new SiteCreationProperties();

                //New-Site URL
                siteCreationProperties.Url = "https://developer19.sharepoint.com/sites/codesite";

                //Titie of the Root Site
                siteCreationProperties.Title = "Coded Site";

                //Login Name
                siteCreationProperties.Owner = "kailash@developer19.onmicrosoft.com";

                //Template Copied from Team Site
                siteCreationProperties.Template = "STS#0";

                //Storage Limit in MB
                siteCreationProperties.StorageMaximumLevel = 100;

                //UserCode resourse Points Allowed
                siteCreationProperties.UserCodeMaximumLevel = 50;

                //Creates Site Collection
                SpoOperation spo = tenant.CreateSite(siteCreationProperties);

                tenantContext.Load(tenant);

                //IsComplete to check if provisioning is Completed
                tenantContext.Load(spo, i => i.IsComplete);

                tenantContext.ExecuteQuery();

                while(!spo.IsComplete)
                    {
                    //Waits 30 Sec and tries again
                    System.Threading.Thread.Sleep(30000);
                    spo.RefreshLoad();
                    tenantContext.ExecuteQuery();
                }
                Console.WriteLine("SiteCollection Created.");
            }
        }
    }
}

【问题讨论】:

    标签: c# .net sharepoint office365 csom


    【解决方案1】:

    租户是组织或公司。它是您的用户群独有的“Office 365 实例”。

    虽然不一定是单个域名,因为租户可能有多个域名,但这是一种考虑方式。

    Office 365 中的租约是指附带的完整 Office 365 套件 到一个域。设置 Office 365 时,它会创建一个租户来存储 Office 365 的所有数据,包括 SharePoint、OneDrive 和亚默。这允许您的所有组织数据位于 相同的环境,并在租户内轻松移动。

    【讨论】:

    • 从技术上讲,您可以在一个 Tennant 下拥有多个域名。例如,丰田租户可能拥有 toyota.com 和 corolla.com。 ClientContext 是一个 Sharepoint 事物,可让您在特定的 SharePoint 网站上工作。我认为每个站点都被认为是一个有点令人困惑的客户。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-04
    • 2022-01-26
    • 2019-03-11
    相关资源
    最近更新 更多