1

I would like to defer the file commit's when i use the SDK upload session. This is possible with the API : https://learn.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://learn.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

Dadv
  • 324
  • 2
  • 17

1 Answers1

0

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.

Diana
  • 690
  • 6
  • 14
  • 1
    Thx, for the answer, could you show me a sample please? i've try to add DeferComit in the AdditionalData but it didn't work. – Dadv May 26 '21 at 10:28
  • You're welcome - I've added a sample above – Diana May 26 '21 at 13:57
  • Sorry, i'have test it but it doesn't work, see my Edit 1. if i send all the file bytes, the file is automaticly commit, and not defer. – Dadv May 30 '21 at 19:14