Microsoft graph api 使用GraphClient在365组上设置自定义属性
我想在265组上设置CustomProperty5。我有以下代码:Microsoft graph api 使用GraphClient在365组上设置自定义属性,microsoft-graph-api,microsoft-graph-sdks,Microsoft Graph Api,Microsoft Graph Sdks,我想在265组上设置CustomProperty5。我有以下代码: var extensions = await graphClient.Groups["xxx"].Extensions.Request().GetAsync(); var dictionary = new Dictionary<string, object>(); dictionary.Add("CustomAttribute5", "Works!"); await graphClient .Groups["xx
var extensions = await graphClient.Groups["xxx"].Extensions.Request().GetAsync();
var dictionary = new Dictionary<string, object>();
dictionary.Add("CustomAttribute5", "Works!");
await graphClient
.Groups["xxx"]
.Request()
.UpdateAsync(new Microsoft.Graph.Group()
{
AdditionalData = dictionary
});
var extensions=await-graphClient.Groups[“xxx”].extensions.Request().GetAsync();
var dictionary=newdictionary();
添加(“CustomAttribute5”,“Works!”);
等待graphClient
.组[“xxx”]
.Request()
.UpdateAsync(新的Microsoft.Graph.Group()
{
附加数据=字典
});
但是,我得到以下错误:
Microsoft.Graph.ServiceException:'代码:请求\请求消息:
指定的一个或多个属性值无效
任何关于如何在365组上设置自定义属性的指针?对于现有组,可以通过msgraph sdk dotnet
如下所示:
//retrieve an existing group custom property
var ext = await graphClient.Groups[groupId].Extensions[extName].Request().GetAsync();
//update
ext.AdditionalData = new Dictionary<string, object>()
{
{
"status", "Closed"
}
};
await graphClient.Groups[groupId].Extensions[extName]
.Request()
.UpdateAsync(ext);
然后,定义了contoso\u grpstatus
复杂类型扩展的现有组实例可以如下更新:
var group = new Group
{
AdditionalData = new Dictionary<string, object>()
{
{
"contoso_grpstatus", new Dictionary<string, object>()
{
{"Status", "Closed"}
}
}
}
};
await graphClient.Groups[groupId]
.Request()
.UpdateAsync(group);
var组=新组
{
AdditionalData=新字典()
{
{
“contoso_grpstatus”,新词典()
{
{“状态”,“关闭”}
}
}
}
};
等待graphClient.Groups[groupId]
.Request()
.UpdateAsync(集团);
非常感谢。SåStatus是contoso_grpstatus上的一个属性,您将其设置为Closed?它是我试图设置的365个组上的内置属性,我需要弄清楚如何将其转换为该特定属性。没错,属性名称和值都在下面指定,其中xxx是我的groupid。这不起作用:var group=new Microsoft.Graph.group{AdditionalData=new Dictionary(){{xx],new Dictionary(){{“CustomAttribute5”,“Works”}}};wait graphClient.Groups[“xxx”].Request().UpdateAsync(组);
var group = new Group
{
AdditionalData = new Dictionary<string, object>()
{
{
"contoso_grpstatus", new Dictionary<string, object>()
{
{"Status", "Closed"}
}
}
}
};
await graphClient.Groups[groupId]
.Request()
.UpdateAsync(group);