C# 如何在OneDrive SDK调用中直接指定@microsoft.graph.conflictBehavior

C# 如何在OneDrive SDK调用中直接指定@microsoft.graph.conflictBehavior,c#,microsoft-graph-api,onedrive,C#,Microsoft Graph Api,Onedrive,根据我先前的问题 我们是否可以将@microsoft.graph.conflictBehavior注释直接添加到SDK调用中,而不是在foldertoCreate对象中指定它 var foldertoCreate = new DriveItem { Name = $"TestFolder", Folder = new Folder (), AdditionalData = new Dictionary<string, object> { {

根据我先前的问题

我们是否可以将
@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);
var foldertoCreate=new DriveItem{
名称=$“TestFolder”,
Folder=新文件夹(),
AdditionalData=新字典{
{“@microsoft.graph.conflictBehavior”,“重命名”}
},
};
//在下面的某个地方打电话
var newFolder=wait_graphClient.Drive
.Items[“我的父项\项目\ Id”]
儿童
.请求()
.AddAsync(foldertoCreate);

如果您只是想整合您的代码,您可以使用单个调用创建一个文件夹调用:

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" } }
});
var newFolder=await\u graphClient.Drive.Items[“MyParent\u Item\u Id”].Children.Request().AddAsync(新的DriveItem(){
名称=$“TestFolder”,
Folder=新文件夹(),
AdditionalData=新字典{{{@microsoft.graph.conflictBehavior”,“重命名”}
});