Previous question继上一个问题之后,
有没有办法可以将@microsoft.graph.conflictBehavior
注释直接添加到SDK调用中,而不是在foldertoCreate
对象中指定它?
var foldertoCreate = new DriveItem {
Name = $"TestFolder",
Folder = new Folder (),
AdditionalData = new Dictionary<string, object> {
{ "@microsoft.graph.conflictBehavior", "rename" }
},
};
// somewhere in the below call
var newFolder = await _graphClient.Drive
.Items["MyParent_Item_Id"]
.Children
.Request ()
.AddAsync (foldertoCreate);
答案 0 :(得分:1)
如果您只是想要整合代码,可以使用单个调用创建更加友好的呼叫:
var newFolder = await _graphClient.Drive.Items["MyParent_Item_Id"].Children.Request ().AddAsync (new DriveItem () {
Name = $"TestFolder",
Folder = new Folder (),
AdditionalData = new Dictionary<string, object> { { "@microsoft.graph.conflictBehavior", "rename" } }
});