Код: Выделить всё
Description: "http://x.y"
Url: "http://x.y"
Мой код заключается в следующем:
Код: Выделить всё
var options = new InteractiveBrowserCredentialOptions
{
TenantId = tenantId,
ClientId = clientId,
AuthorityHost = AzureAuthorityHosts.AzurePublicCloud,
RedirectUri = new Uri("http://localhost")
};
var interactiveCredential = new InteractiveBrowserCredential(options);
var graphClient = new GraphServiceClient(interactiveCredential, scopes);
var items = await graphClient
.Sites[siteId]
.Lists[listId]
.Items
.GetAsync(requestConfiguration =>
{
requestConfiguration.QueryParameters.Expand = new[] { "fields" };
requestConfiguration.QueryParameters.Top = 100;
});
foreach (var item in items.Value)
{
var fields = item.Fields?.AdditionalData;
if (fields == null) continue;
if (fields.TryGetValue("URL", out var _url) && _url is UntypedObject uo) // testing read
{
foreach (var (name, node) in uo.GetValue())
{
var scalarAsString = await KiotaJsonSerializer.SerializeAsStringAsync(node);
$"{name}: {scalarAsString}".Dump();
}
continue;
}
var table = new UntypedObject(new Dictionary
{
["url"] = new UntypedString("whateverurl"),
["description"] = new UntypedString("whatevertext"),
});
var updateFields = new FieldValueSet
{
AdditionalData = new Dictionary
{
["URL"] = table,
["Server"] = "whatever" // this on its own works
}
};
await graphClient
.Sites[siteId]
.Lists[listId]
.Items[item.Id]
.Fields
.PatchAsync(updateFields);
}
Обновление:
, кажется, не поддерживается с тех пор, это стыдно, чтобы быть прямым: https://learn.microsoft.com/en-us/answe ... link-colum твою https://learn.microsoft.com/en-us/share ... ?tabs=csom
Подробнее здесь: https://stackoverflow.com/questions/797 ... g-graphapi
Мобильная версия