英文:
What is Tenant in Office 365?
问题
我是Office 365和SharePoint的新手,我尝试在.NET中使用CSOM创建SharePoint站点时,我使用了类似这样的Tenant(var tenant = new Tenant(clientContext);),有人可以解释一下"Tenant"到底是什么,以及在这里的用途是什么吗?当我搜索它时,我了解到"Tenant ID"是每个公司独一无二的,但"Tenant ID"和CSOM中的"Tenant"是不同的,对吗?还有,"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!");
// 打开管理员URL
using(ClientContext tenantContext=new ClientContext("https://developer19-admin.sharepoint.com/"))
{
// 使用Tenant管理员身份验证
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);
// 属性
var siteCreationProperties = new SiteCreationProperties();
// 新站点URL
siteCreationProperties.Url = "https://developer19.sharepoint.com/sites/codesite";
// 根站点的标题
siteCreationProperties.Title = "Coded Site";
// 登录名
siteCreationProperties.Owner = "kailash@developer19.onmicrosoft.com";
// 从Team Site复制的模板
siteCreationProperties.Template = "STS#0";
// 存储限制(以MB为单位)
siteCreationProperties.StorageMaximumLevel = 100;
// 允许的UserCode资源点数
siteCreationProperties.UserCodeMaximumLevel = 50;
// 创建站点集合
SpoOperation spo = tenant.CreateSite(siteCreationProperties);
tenantContext.Load(tenant);
// 用于检查是否完成创建
tenantContext.Load(spo, i => i.IsComplete);
tenantContext.ExecuteQuery();
while(!spo.IsComplete)
{
// 等待30秒后重试
System.Threading.Thread.Sleep(30000);
spo.RefreshLoad();
tenantContext.ExecuteQuery();
}
Console.WriteLine("SiteCollection Created.");
}
}
}
}
英文:
I'm new to Office 365 and SharePoint, while I'm trying to create a SharePoint site using CSOM in .NET I've used Tenant like (var tenant = new Tenant(clientContext);) can someone explain what "Tenant" exactly is and what is the use of it in here. When I searched for it I learnt something like Tenant ID which Unique for each Company, but Tenant ID and Tenant in CSOM is different right? and also What is ClientContext? in my code I have used both ClientContext and Tenant to create a SharePoint Site.
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.");
}
}
}
}
答案1
得分: 1
租户是组织或公司。它是“Office 365的实例”,专属于您的用户群。
虽然它不一定是单个域名,因为一个租户可以有多个域名,但这是一种考虑方式。
Office 365中的租户是指附加到域的完整Office 365套件。
Office 365设置时,会创建一个租户来存储
所有与Office 365相关的数据,包括SharePoint、OneDrive
和Yammer等内容。这允许您的组织数据都在同一环境中,并且可以轻松地在租户内移动。
英文:
A Tenant is the Organisation or the Company. It's the "instance of Office 365" that is unique to your user base.
While it's not necessarily a single domain name, because a Tenant could have multiple domain names, that's one way to think of it.
> A tenancy in Office 365 refers to the full Office 365 suite attached
> to a domain. When Office 365 is set up, it creates a tenancy to store
> all the data for Office 365 including things like SharePoint, OneDrive
> and Yammer. This allows all of your organisations data to sit in the
> same environment and be moved around within the tenant with ease.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论