SharePoint online does not let you create a record and attach a file to it at the same time. You need to do the following tasks to create a new item in a SharePoint online list:

  • Establish the connection to the server using ClientContext
  • Prepare your record data (including list name, record title, file path of the attachment and any additional fields you need to include)
  • Create a list item using ListItemCreationInformation and fill it with the record data you prepared (except the file path).
  • Retrieve the ListItem you just created (search for it using the item id from the record you created), so you can use it to link your file to it. …


David Garces

Developer, Technologist and Blogger

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store