Microsoft图形用户具有属性createdDateTime但我无法使用它因为user.cs没有可用的属性createdDateTime

问题描述 投票:0回答:1

我正在尝试从Microsoft图形用户中获取创建用户的日期(createdDateTime)。

在Microsoft Graph Explorer中,您可以找到该属性并且它具有值。但是当我尝试在我的c#代码中填写我的属性时,microsoft.graph.user没有任何类型的属性createdDateTime,所以它属于其他什么或者尚未实现?

List<QueryOption> options = new List<QueryOption>
                    {
                         new QueryOption("$select", "id,userPrincipalName,createdDateTime")
                    };

var graphserviceClient = new GraphServiceClient(new DelegateAuthenticationProvider((requestMessage) => { requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", BearerToken.access_token); return Task.FromResult(0); }));

var AllUsers = await graphserviceClient.Users.Request(options).GetAsync();

foreach ( Microsoft.Graph.User FoundUser in AllUsers)
                {
                    DateTimeOffset? cD = FoundUser.???//createdDateTime 
                }

在图中https://graph.microsoft.com/v1.0/me/?$ select = displayName,createdDateTime

结果

"displayName": "-K*** D****",
"createdDateTime": "2016-10-26T20:30:04Z"

预期:我已经知道在哪里可以获得存储在图表中的此属性的值

c# microsoft-graph
1个回答
0
投票

这是因为createdDateTime属性在AdditionalData字典中可用,该字典位于用户继承的父类Entity之一内。

用户:DirectoryObject:实体

public IDictionary<string, object> AdditionalData { get; set; }

你会在那里找到它。

© www.soinside.com 2019 - 2024. All rights reserved.