0
votes

I would like to defer the file commit's when i use the SDK upload session. This is possible with the API : https://docs.microsoft.com/en-us/graph/api/driveitem-createuploadsession?view=graph-rest-1.0

{ "item": { "@microsoft.graph.conflictBehavior": "rename" }, "deferCommit": true }

But in the SDK : https://docs.microsoft.com/en-us/graph/sdks/large-file-upload?tabs=csharp I couldn't find the equivalent in DriveItemUploadableProperties object

public class DriveItemUploadableProperties
{        
    public DriveItemUploadableProperties();
    
    public string Description { get; set; }
   
    public long? FileSize { get; set; }
    
    public FileSystemInfo FileSystemInfo { get; set; }
   
    public string Name { get; set; }
   
    public IDictionary<string, object> AdditionalData { get; set; }
    
    public string ODataType { get; set; }
}

How do i send the deferCommit flag and how do i send the completing flag ?

Edit 1 :

I've try :

 DriveItemUploadableProperties properties = new DriveItemUploadableProperties
        {
            ODataType = null,
            AdditionalData = new Dictionary<string, object>
            {
                { "@microsoft.graph.conflictBehavior", "replace" },
                {"deferCommit", true}
            }
        };

but it doesn't work

1

1 Answers

0
votes

The deferCommit property isn't a member of the driveItemUploadableProperties class. This property should be set as part of the AdditionalData of DriveItemUploadableProperties. Please see documentation on completing a file for details on how to explicitly complete the upload.

This might look something like this:

    AdditionalData = new Dictionary<string, object>
    {
        { "@microsoft.graph.conflictBehavior", "replace" },
        {"deferCommit", true}
    },

Let me know whether this helps and if you have further questions.