New-SPOFile

Creates a new list file within an existing List.

New-SPOFile [-List [<SPOListPipeBind>]] -Web <SPOWebPipeBind> -File <String> [-Overwrite [<SwitchParameter>]] [-FieldValues [<PropertiesPipeBind>]]

New-SPOFile [-Folder [<SPOFolder>]] -Web <SPOWebPipeBind> -File <String> [-Overwrite [<SwitchParameter>]] [-FieldValues [<PropertiesPipeBind>]]

Parameters

1

ParameterRequiredTypeDescription
ListFalseSPOListPipeBind

Specifies the List to add the file to.

The type must be a valid absolute URL, in the form http://contoso.sharepoint.com/site_name/lists/list_name, or an SPOList object, Microsoft.SharePoint.Client.List object, List title, or GUID representing the List ID.

WebTrueSPOWebPipeBind

Specifies the identity of the Site containing the List to add the file to.

The type must be a valid server relative URL, in the form /site_name, or an SPOWeb object, Microsoft.SharePoint.Client.Web object, or GUID representing the Site ID.

FileTrueString

Specify the path to the file to add to the list.

OverwriteFalseSwitchParameter

Overwrite an existing file if present.

FieldValuesFalsePropertiesPipeBind

The collection of field values to set where the key is the internal field name. The type must be a hash table where each key represents the name of a field whose value should be set to the corresponding key value (e.g., @{"Field1"="Value1";"Field2"="Value2"}). Alternatively, provide the path to a file with XML property settings (<Properties><Property Name="Name1">Value1</Property><Property Name="Name2">Value2</Property></Properties>).

2

ParameterRequiredTypeDescription
FolderFalseSPOFolder

Specifies the Folder to add the file to.

The type must be a valid SPOFolder object.

WebTrueSPOWebPipeBind

Specifies the identity of the Site containing the List to add the file to.

The type must be a valid server relative URL, in the form /site_name, or an SPOWeb object, Microsoft.SharePoint.Client.Web object, or GUID representing the Site ID.

FileTrueString

Specify the path to the file to add to the list.

OverwriteFalseSwitchParameter

Overwrite an existing file if present.

FieldValuesFalsePropertiesPipeBind

The collection of field values to set where the key is the internal field name. The type must be a hash table where each key represents the name of a field whose value should be set to the corresponding key value (e.g., @{"Field1"="Value1";"Field2"="Value2"}). Alternatively, provide the path to a file with XML property settings (<Properties><Property Name="Name1">Value1</Property><Property Name="Name2">Value2</Property></Properties>).

Detailed Description

Creates a new list file within an existing List.

Copyright 2016 Falchion Consulting, LLC

> For more information on this cmdlet and others:

> http://blog.falchionconsulting.com/

> Use of this cmdlet is at your own risk.

> Gary Lapointe assumes no liability.

Examples

------------------EXAMPLE------------------

PS C:\> New-SPOFile -Web "/" -List "My List" -File "c:\myfile.txt" -FieldValues @{"Title"="My new file"}

This example creates a new file within the List My List under the root Site of the current Site Collection.