我使用Microsoft图形创建新用户
https://docs.microsoft.com/en-us/graph/api/user-post-users?view=graph-rest-1.0
它工作正常。但我想,该用户不应位于“全局地址”列表中,我想为已创建的用户关闭此功能:
我看了一下文档,User
对象中没有这样的选项,Contact
对象中没有找到。是否可以使用Graph API设置“在全局地址列表中显示” = false(默认情况下,创建用户为true
)?
答案 0 :(得分:2)
Microsoft Graph的用户对象中未浮现用户的所有设置。 https://docs.microsoft.com/en-us/graph/api/resources/user?view=graph-rest-1.0
使用https://developer.microsoft.com/en-us/graph/graph-explorer?request= $ metadata&method = GET&version = v1.0&GraphUrl = https://graph.microsoft.com
有时对MIcrosoft Graph的CDSL定义很有用。您将看到此entityType
<EntityType Name="user" BaseType="microsoft.graph.directoryObject" OpenType="true">
<Property Name="accountEnabled" Type="Edm.Boolean" />
<Property Name="ageGroup" Type="Edm.String" />
<Property Name="assignedLicenses" Type="Collection(microsoft.graph.assignedLicense)" Nullable="false" />
<Property Name="assignedPlans" Type="Collection(microsoft.graph.assignedPlan)" Nullable="false" />
<Property Name="businessPhones" Type="Collection(Edm.String)" Nullable="false" />
<Property Name="city" Type="Edm.String" />
<Property Name="companyName" Type="Edm.String" />
<Property Name="consentProvidedForMinor" Type="Edm.String" />
<Property Name="country" Type="Edm.String" />
<Property Name="department" Type="Edm.String" />
<Property Name="displayName" Type="Edm.String" />
<Property Name="employeeId" Type="Edm.String" />
<Property Name="faxNumber" Type="Edm.String" />
<Property Name="givenName" Type="Edm.String" />
<Property Name="imAddresses" Type="Collection(Edm.String)" />
<Property Name="jobTitle" Type="Edm.String" />
<Property Name="legalAgeGroupClassification" Type="Edm.String" />
<Property Name="licenseAssignmentStates" Type="Collection(microsoft.graph.licenseAssignmentState)" />
<Property Name="mail" Type="Edm.String" />
<Property Name="mailNickname" Type="Edm.String" />
<Property Name="mobilePhone" Type="Edm.String" />
<Property Name="onPremisesDistinguishedName" Type="Edm.String" />
<Property Name="onPremisesExtensionAttributes" Type="microsoft.graph.onPremisesExtensionAttributes" />
<Property Name="onPremisesImmutableId" Type="Edm.String" />
<Property Name="onPremisesLastSyncDateTime" Type="Edm.DateTimeOffset" />
<Property Name="onPremisesProvisioningErrors" Type="Collection(microsoft.graph.onPremisesProvisioningError)" />
<Property Name="onPremisesSecurityIdentifier" Type="Edm.String" />
<Property Name="onPremisesSyncEnabled" Type="Edm.Boolean" />
<Property Name="onPremisesDomainName" Type="Edm.String" />
<Property Name="onPremisesSamAccountName" Type="Edm.String" />
<Property Name="onPremisesUserPrincipalName" Type="Edm.String" />
<Property Name="otherMails" Type="Collection(Edm.String)" Nullable="false" />
<Property Name="passwordPolicies" Type="Edm.String" />
<Property Name="passwordProfile" Type="microsoft.graph.passwordProfile" />
<Property Name="officeLocation" Type="Edm.String" />
<Property Name="postalCode" Type="Edm.String" />
<Property Name="preferredLanguage" Type="Edm.String" />
<Property Name="provisionedPlans" Type="Collection(microsoft.graph.provisionedPlan)" Nullable="false" />
<Property Name="proxyAddresses" Type="Collection(Edm.String)" Nullable="false" />
<Property Name="showInAddressList" Type="Edm.Boolean" />
<Property Name="state" Type="Edm.String" />
<Property Name="streetAddress" Type="Edm.String" />
<Property Name="surname" Type="Edm.String" />
<Property Name="usageLocation" Type="Edm.String" />
<Property Name="userPrincipalName" Type="Edm.String" />
<Property Name="userType" Type="Edm.String" />
<Property Name="mailboxSettings" Type="microsoft.graph.mailboxSettings" />
<Property Name="aboutMe" Type="Edm.String" />
<Property Name="birthday" Type="Edm.DateTimeOffset" Nullable="false" />
<Property Name="hireDate" Type="Edm.DateTimeOffset" Nullable="false" />
<Property Name="interests" Type="Collection(Edm.String)" />
<Property Name="mySite" Type="Edm.String" />
<Property Name="pastProjects" Type="Collection(Edm.String)" />
<Property Name="preferredName" Type="Edm.String" />
<Property Name="responsibilities" Type="Collection(Edm.String)" />
<Property Name="schools" Type="Collection(Edm.String)" />
<Property Name="skills" Type="Collection(Edm.String)" />
<Property Name="deviceEnrollmentLimit" Type="Edm.Int32" Nullable="false" />
<NavigationProperty Name="ownedDevices" Type="Collection(microsoft.graph.directoryObject)" />
<NavigationProperty Name="registeredDevices" Type="Collection(microsoft.graph.directoryObject)" />
<NavigationProperty Name="manager" Type="microsoft.graph.directoryObject" />
<NavigationProperty Name="directReports" Type="Collection(microsoft.graph.directoryObject)" />
<NavigationProperty Name="memberOf" Type="Collection(microsoft.graph.directoryObject)" />
<NavigationProperty Name="createdObjects" Type="Collection(microsoft.graph.directoryObject)" />
<NavigationProperty Name="ownedObjects" Type="Collection(microsoft.graph.directoryObject)" />
<NavigationProperty Name="licenseDetails" Type="Collection(microsoft.graph.licenseDetails)" ContainsTarget="true" />
<NavigationProperty Name="transitiveMemberOf" Type="Collection(microsoft.graph.directoryObject)" />
<NavigationProperty Name="extensions" Type="Collection(microsoft.graph.extension)" ContainsTarget="true" />
<NavigationProperty Name="outlook" Type="microsoft.graph.outlookUser" ContainsTarget="true" />
<NavigationProperty Name="messages" Type="Collection(microsoft.graph.message)" ContainsTarget="true" />
<NavigationProperty Name="mailFolders" Type="Collection(microsoft.graph.mailFolder)" ContainsTarget="true" />
<NavigationProperty Name="calendar" Type="microsoft.graph.calendar" ContainsTarget="true" />
<NavigationProperty Name="calendars" Type="Collection(microsoft.graph.calendar)" ContainsTarget="true" />
<NavigationProperty Name="calendarGroups" Type="Collection(microsoft.graph.calendarGroup)" ContainsTarget="true" />
<NavigationProperty Name="calendarView" Type="Collection(microsoft.graph.event)" ContainsTarget="true" />
<NavigationProperty Name="events" Type="Collection(microsoft.graph.event)" ContainsTarget="true" />
<NavigationProperty Name="people" Type="Collection(microsoft.graph.person)" ContainsTarget="true" />
<NavigationProperty Name="contacts" Type="Collection(microsoft.graph.contact)" ContainsTarget="true" />
<NavigationProperty Name="contactFolders" Type="Collection(microsoft.graph.contactFolder)" ContainsTarget="true" />
<NavigationProperty Name="inferenceClassification" Type="microsoft.graph.inferenceClassification" ContainsTarget="true" />
<NavigationProperty Name="photo" Type="microsoft.graph.profilePhoto" ContainsTarget="true" />
<NavigationProperty Name="photos" Type="Collection(microsoft.graph.profilePhoto)" ContainsTarget="true" />
<NavigationProperty Name="drive" Type="microsoft.graph.drive" ContainsTarget="true" />
<NavigationProperty Name="drives" Type="Collection(microsoft.graph.drive)" ContainsTarget="true" />
<NavigationProperty Name="planner" Type="microsoft.graph.plannerUser" ContainsTarget="true" />
<NavigationProperty Name="onenote" Type="microsoft.graph.onenote" ContainsTarget="true" />
<NavigationProperty Name="managedDevices" Type="Collection(microsoft.graph.managedDevice)" ContainsTarget="true" />
<NavigationProperty Name="managedAppRegistrations" Type="Collection(microsoft.graph.managedAppRegistration)" />
<NavigationProperty Name="deviceManagementTroubleshootingEvents" Type="Collection(microsoft.graph.deviceManagementTroubleshootingEvent)" ContainsTarget="true" />
<NavigationProperty Name="activities" Type="Collection(microsoft.graph.userActivity)" ContainsTarget="true" />
<NavigationProperty Name="insights" Type="microsoft.graph.officeGraphInsights" ContainsTarget="true" />
<NavigationProperty Name="settings" Type="microsoft.graph.userSettings" ContainsTarget="true" />
<NavigationProperty Name="joinedTeams" Type="Collection(microsoft.graph.group)" ContainsTarget="true" />
</EntityType>
文档列出了所有这些内容。不幸的是,这里似乎没有全局通讯录设置。如果这是您想在Microsoft Graph上看到的东西。您可以按照https://developer.microsoft.com/en-us/graph/support
在User Voice上将其作为产品功能请求进行请求答案 1 :(得分:1)
我是这样实现的(使用Microsoft.Graph
nuget包:
public class UserEx : User
{
[JsonProperty(PropertyName ="showInAddressList")]
public bool ShowInAddressList { get; set; }
}
然后将该对象传递给GraphClient
:
user.ShowInAddressList = false;
userResult = await _graphClient.Users.Request().AddAsync(user);
注册后的结果:
感谢Jeremy Thake MSFT!
答案 2 :(得分:0)
伙计,
v1.0中提供了用于设置在全局地址列表中显示用户的位置的属性,并且该属性在v1.0中可用。它是showInAddressList
资源上的user
属性。参见https://docs.microsoft.com/en-us/graph/api/resources/user?view=graph-rest-1.0#properties
showInAddressList
布尔值
true,否则为false。如果未设置,则将其视为true。对于通过邀请管理器邀请的用户,此属性将设置为false。
希望这会有所帮助,