2017-08-29 37 views
1

Previous question從我剛纔的問題上之後,如何指定@ microsoft.graph.conflictBehavior直接進入OneDrive SDK調用

是否有一個地方,可以我們直接添加@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

如果你只是你尋求整合你的代碼,你可以使用創建afolder呼叫單呼:

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" } } 
}); 
相關問題