创建 educationUser

命名空间:microsoft.graph

创建新的 educationUser 对象。

权限

要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限

权限类型 权限(从最低特权到最高特权)
委派(工作或学校帐户) 不支持。
委派(个人 Microsoft 帐户) 不支持。
应用程序 EduRoster.ReadWrite.All

HTTP 请求

POST /education/users

请求标头

名称 说明
Authorization Bearer {token}。必需。
Content-Type application/json. Required.

请求正文

在请求正文中,提供 educationUser 对象的 JSON 表示形式。

下表显示创建 educationUser时所需的属性。

属性 类型 说明
accountEnabled 布尔 如果帐户已启用,则为 true;否则,为 false。 创建用户时此属性是必需的。 支持 $filter。
assignedLicenses assignedLicense collection 分配给该用户的许可证。不可为 null。
assignedPlans assignedPlan collection 分配给该用户的计划。只读。不可为 null。
businessPhones String collection 用户的电话号码。 注意: 虽然这是字符串集合,但是只能为该属性设置一个号码。
createdBy identitySet 创建了用户的实体。
department String 用户工作部门的名称。支持 $filter。
displayName String 用户通讯簿中显示的名称。 这通常是用户名字、中间名首字母和姓氏的组合。 此属性在创建用户时是必需的,并且在更新过程中不能清除。 支持 $filter 和 $orderby。
externalSource educationExternalSource 创建此用户的位置。 可取值为:sismanual
externalSourceDetail String 生成此资源的外部源的名称。
givenName String 用户的名。支持 $filter。
mail String 用户的 SMTP 地址;例如,“jeff@contoso.onmicrosoft.com”。 只读。 支持 $filter。
mailingAddress physicalAddress 用户的邮件地址。
mailNickname String 用户的邮件别名。创建用户时必须指定此属性。支持 $filter。
middleName String 用户的中间名。
mobilePhone String 用户的主要移动电话号码。
onPremisesInfo educationOnPremisesInfo 用于将用户与 active Directory AAD关联的其他信息。
passwordPolicies String 指定用户的密码策略。 此值是一个枚举,具有一个可能值 “DisableStrongPassword”,允许指定比默认策略弱的密码。 还可以指定 “DisablePasswordExpiration”。 可以同时指定两个值;例如:“DisablePasswordExpiration、DisableStrongPassword”。
passwordProfile passwordProfile 指定用户的密码配置文件。配置文件包含用户的密码。创建用户时此属性是必需的。配置文件中的密码必须满足 passwordPolicies 属性指定的最低要求。默认情况下,必须使用强密码。
preferredLanguage String 用户的首选语言。 应遵循 ISO 639-1 代码;例如“en-US”。
primaryRole educationUserRole 用户的默认角色。 用户的角色在各课程中可能有所不同。 可取值为:studentteachernone
provisionedPlans provisionedPlan 集合 为用户设置的计划。只读。不可为 null。
residenceAddress physicalAddress 用户所在的地址。
student educationStudent 如果主要角色为学生,此部分将包含特定于学生的数据。
surname String 用户的姓氏。支持 $filter。
teacher educationTeacher 如果主要角色是教师,则此块将包含特定于教师的数据。
usageLocation String 两个字母组成的国家/地区代码(ISO 标准 3166)。 鉴于检查服务在国家/地区的可用性的法律要求,这对将分配许可证的用户而言是必需的。 示例包括:“US”、“JP”和“GB”。 不可为 null。 支持 $filter。
userPrincipalName String 用户的用户主体名称 (UPN)。
userType String 可用于对目录中的用户类型分类的字符串值,例如“成员”和“访客”。支持 $filter。

响应

如果成功,此方法会在响应正文中返回 201 Created 响应代码和 educationUser 对象。

示例

请求

POST https://graph.microsoft.com/v1.0/education/users
Content-Type: application/json

{
  "@odata.type": "#microsoft.graph.educationUser",
  "primaryRole": "String",
  "middleName": "String",
  "externalSource": "String",
  "externalSourceDetail": "String",
  "residenceAddress": {
    "@odata.type": "microsoft.graph.physicalAddress"
  },
  "mailingAddress": {
    "@odata.type": "microsoft.graph.physicalAddress"
  },
  "student": {
    "@odata.type": "microsoft.graph.educationStudent"
  },
  "teacher": {
    "@odata.type": "microsoft.graph.educationTeacher"
  },
  "createdBy": {
    "@odata.type": "microsoft.graph.identitySet"
  },
  "accountEnabled": "Boolean",
  "assignedLicenses": [
    {
      "@odata.type": "microsoft.graph.assignedLicense"
    }
  ],
  "assignedPlans": [
    {
      "@odata.type": "microsoft.graph.assignedPlan"
    }
  ],
  "businessPhones": [
    "String"
  ],
  "department": "String",
  "displayName": "String",
  "givenName": "String",
  "mail": "String",
  "mailNickname": "String",
  "mobilePhone": "String",
  "passwordPolicies": "String",
  "passwordProfile": {
    "@odata.type": "microsoft.graph.passwordProfile"
  },
  "officeLocation": "String",
  "preferredLanguage": "String",
  "provisionedPlans": [
    {
      "@odata.type": "microsoft.graph.provisionedPlan"
    }
  ],
  "refreshTokensValidFromDateTime": "String (timestamp)",
  "showInAddressList": "Boolean",
  "surname": "String",
  "usageLocation": "String",
  "userPrincipalName": "String",
  "userType": "String",
  "onPremisesInfo": {
    "@odata.type": "microsoft.graph.educationOnPremisesInfo"
  }
}

响应

注意: 为了提高可读性,可能缩短了此处显示的响应对象。

HTTP/1.1 201 Created
Content-Type: application/json

{
  "@odata.type": "#microsoft.graph.educationUser",
  "id": "90eedea1-dea1-90ee-a1de-ee90a1deee90",
  "primaryRole": "String",
  "middleName": "String",
  "externalSource": "String",
  "externalSourceDetail": "String",
  "residenceAddress": {
    "@odata.type": "microsoft.graph.physicalAddress"
  },
  "mailingAddress": {
    "@odata.type": "microsoft.graph.physicalAddress"
  },
  "student": {
    "@odata.type": "microsoft.graph.educationStudent"
  },
  "teacher": {
    "@odata.type": "microsoft.graph.educationTeacher"
  },
  "createdBy": {
    "@odata.type": "microsoft.graph.identitySet"
  },
  "accountEnabled": "Boolean",
  "assignedLicenses": [
    {
      "@odata.type": "microsoft.graph.assignedLicense"
    }
  ],
  "assignedPlans": [
    {
      "@odata.type": "microsoft.graph.assignedPlan"
    }
  ],
  "businessPhones": [
    "String"
  ],
  "department": "String",
  "displayName": "String",
  "givenName": "String",
  "mail": "String",
  "mailNickname": "String",
  "mobilePhone": "String",
  "passwordPolicies": "String",
  "passwordProfile": {
    "@odata.type": "microsoft.graph.passwordProfile"
  },
  "officeLocation": "String",
  "preferredLanguage": "String",
  "provisionedPlans": [
    {
      "@odata.type": "microsoft.graph.provisionedPlan"
    }
  ],
  "refreshTokensValidFromDateTime": "String (timestamp)",
  "showInAddressList": "Boolean",
  "surname": "String",
  "usageLocation": "String",
  "userPrincipalName": "String",
  "userType": "String",
  "onPremisesInfo": {
    "@odata.type": "microsoft.graph.educationOnPremisesInfo"
  }
}