如何在 OneDrive SDK 调用中直接指定 @microsoft.graph.conflictBehavior
How to specify @microsoft.graph.conflictBehavior directly into OneDrive SDK call
继我之前的问题之后,
有什么方法可以直接在 SDK 调用中添加 @microsoft.graph.conflictBehavior
注释而不是在 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 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" } }
});
有什么方法可以直接在 SDK 调用中添加 @microsoft.graph.conflictBehavior
注释而不是在 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 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" } }
});