SharePoint / SharePoint/sp-dev-docs

CSOM has no way to create a file in a library with required metadata without filling ii tin as the UI does.

Open
#10,819 9 comments 0 reactions 1 assignee View on GitHub

@Ashlesha-MSFT is already working on this.

Since May 5, 2026.

area:csom/rest/api Needs: Author Feedback sharepoint-developer-support type:bug-suspected
Dominant language
PowerShell
Stars
1.4k
Forks
1.1k
Avg merge
4d 12h
Merged PRs (30d)
12

Description

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

SharePoint CSOM

Developer environment

Windows

What browser(s) / client(s) have you tested
  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)
Additional environment details

Issue is there in CSOM 16.1.27011.12008, but the same applies to current Power Automate actions.

Describe the bug / error

There is no way to create a file on a library (even leaving it checked out) without filling in the properties at the same time in a way that matches the UI (both modern/classic). The upload without properties will always fail with a "List data validation failed." error.

Steps to reproduce

execute something like this on a library with required metadata and no defaults:

using (MemoryStream contentStream = new())
{
    // Add an empty file.

    uploadFolder = destinationClientContext.Web.GetFolderByServerRelativeUrl(Path.Combine(site.AbsoluteUri,uploadFolderServerRelativeURL));
    destinationClientContext.Load(uploadFolder, f => f.ServerRelativeUrl);
    await destinationClientContext.ExecuteQueryAsync();

    FileCreationInformation emptyFci = new()
    {
        ContentStream = contentStream,
        Url = destinationFileName,
        Overwrite = true
    };

    uploadFile = uploadFolder.Files.Add(emptyFci);

    // push content in chunks... doesn't matter.

    await destinationClientContext.ExecuteQueryAsync();
}
Expected behavior

The file should be uploaded but be checked out -- OR -- there should be a switch in the FileCreationInformation like CheckRequiredFields (as SaveBinary). The same should apply to the Power Automate actions.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.