create_sp_list_column() adds a column to a SharePoint list and
delete_sp_list_column() removes a column to a SharePoint list.
update_sp_list_column() updates a column definition for an existing column
in a SharePoint list. Only properties that differ from the existing column
are sent. Use sync_sp_list() for changes the Graph API can't make,
such as switching a text column to multiple lines.
Usage
create_sp_list_column(
sp_list = NULL,
...,
column_name = NULL,
column_definition = NULL,
list_name = NULL,
site_url = NULL,
site = NULL,
call = caller_env()
)
update_sp_list_column(
sp_list = NULL,
column_name = NULL,
column_id = NULL,
...,
list_name = NULL,
site_url = NULL,
site = NULL,
column_definition = NULL,
column_name_type = "name",
call = caller_env()
)
delete_sp_list_column(
sp_list = NULL,
column_name = NULL,
column_id = NULL,
list_name = NULL,
site_url = NULL,
site = NULL,
column_name_type = "name",
call = caller_env()
)Arguments
- sp_list
A
ms_listobject. If supplied,list_name,list_id,site_url,site,drive_name,drive_id,drive, and any additional parameters passed to...are all ignored.- ...
Arguments passed on to
create_column_definitionnameColumn name. Graph property:
name. The name can't be changed after a column is created.display_asValue displayed as option. For
create_choice_columnone ofc("checkBoxes", "dropDownMenu", "radioButtons"). Forcreate_number_column, one ofc("number", "percentage"). Forcreate_datetime_column, one ofc("default", "friendly", "standard"). Graph property:displayAs..col_typeColumn type. Defaults to "text". Must be one of "boolean", "calculated", "choice", "currency", "dateTime", "lookup", "number", "personOrGroup", "text", "term", "hyperlinkOrPicture", "thumbnail", "contentApprovalStatus", or "geolocation".
enforce_uniqueEnforce unique values in column. Graph property:
enforceUniqueValues.hiddenIf
TRUE, column will be hidden by default. Graph property:hidden.deletableIf
TRUE, column can't be deleted separate from the list. Graph property:isDeletable.requiredIf
TRUE, column will be required. Graph property:required.defaultDefault value set by helper
get_column_default()function. Graph property:defaultValue.descriptionColumn description. Graph property:
description.display_nameColumn display name. Graph property:
displayName.displaynamevalidationColumn validation created with
column_validation(). Graph property:validation.indexed,sealed,propagate_changes,read_only,idAdditional arguments used by
create_column_definition(). Graph properties:indexed,isSealed,propagateChanges,readOnly, andid.multiple_linesLogical. If
TRUE, allow multiple lines of text. Graph property:allowMultipleLines.append_changesLogical. If
TRUE, append changes to existing value for column. Graph property:appendChangesToExistingText.linesWhole number. Size of the text box. Graph property:
linesForEditing.max_lengthWhole number. Max length in number of characters. Graph property:
maxLength.text_typeOne of
c("plain", "richText"). Graph property:textType.choicesA character vector of choice options. Graph property:
choices.allow_naIf
TRUE, allow NA values inchoices.na_replacementUsed as
replacementbystringr::str_replace_na()onchoicesif they contain NA values.allow_textIf
TRUE, allow text entry in the choice column. Graph property:allowTextEntry.decimal_placesOne of
c("automatic", "none", "one", "two", "three", "four", "five")or a whole number between 0 and 5. Graph property:decimalPlaces.max,minMinimum and maximum values allowed in number column. Graph properties:
maximumandminimum.decimalsformatFor
create_datetime_column(),"dateOnly"or"dateTime". Graph property:format.localeLocale used to set the currency symbol, e.g.
"en-us". Graph property:locale.formulaRequired string with formula for calculated column definition. See examples of common formulas in lists. Reference existing columns using the display name enclosed in square brackets. The formula must start with an equals sign
"="which this function appends to the formula text if it is missing. The formula is processed withglue::glue(). Graph property:formula.output_typeValue type returned by calculated formula. One of
c("text", "boolean", "currency", "dateTime", "number"). Defaults to"text". Graph property:outputType.lookup_list_columnName of lookup column in the lookup list to use. Graph property:
columnName.lookup_list_id,lookup_listLookup list ID string or "ms_list" class object with id value in list properties. Graph property:
listId.allow_multiple_valuesIf
TRUE, allow a lookup or term column to store multiple values. Graph property:allowMultipleValues.allow_unlimited_lengthIf
TRUE, allow lookup column to return any length value. Graph property:allowUnlimitedLength.primary_lookup_column_idIf column definition is for a secondary column, the primary lookup column ID must be supplied. Graph property:
primaryLookupColumnId.allow_multipleUse
allow_multiple_valuesforcreate_lookup_column()andcreate_term_column()orallow_multiple_selectionforcreate_person_column()andcreate_group_column().allow_multiple_selectionIf
TRUE, allow a person or group column to store multiple values. Graph property:allowMultipleSelection.from_typeWhat type of resources to choose from. Defaults to "peopleOnly" for
create_person_column()or "peopleAndGroups" forcreate_group_column(). Graph property:chooseFromType.is_pictureLogical indicator for display of hyperlink value as link (
FALSE, default forcreate_hyperlink_column()) or image (TRUE, default forcreate_picture_column()). Graph property:isPicture.show_full_nameIf
TRUE, display the entire term path. Graph property:showFullyQualifiedName.splitcharacter vector (or object which can be coerced to such) containing regular expression(s) (unless
fixed = TRUE) to use for splitting. If empty matches occur, in particular ifsplithas length 0,xis split into single characters. Ifsplithas length greater than 1, it is re-cycled alongx.
- column_name, column_id
Column ID for column to delete.
- column_definition
List with column definition created with
create_column_definition()or a related function. Optional ifcolumn_nameand any required additional parameters are provided. Acustomelement (e.g. fromread_sp_list_yaml()) is dropped. Avalidationelement is applied with the SharePoint REST API since the Graph API doesn't support it.- list_name
List name. Required if
sp_listisNULL.- site_url
A SharePoint site URL in the format "https://[tenant name].sharepoint.com/sites/[site name]". Any SharePoint item or document URL can also be parsed to build a site URL using the tenant and site name included in the URL.
- site
A
ms_siteobject. Ifsiteis supplied,site_url,site_name, andsite_idare ignored.- call
The execution environment of a currently running function, e.g.
caller_env(). The function will be mentioned in error messages as the source of the error. See thecallargument ofabort()for more information.- column_name_type
"name" or "displayName". Used to match column ID so column_name must be unique if
column_name_type = "displayName".
Value
For create_sp_list_column(), a named list with the newly
created columnDefinition resource. For update_sp_list_column(),
invisibly returns the input sp_list. For delete_sp_list_column(), an
empty list with a "status" attribute giving the HTTP response status
code.
Details
See documentation: https://learn.microsoft.com/en-us/graph/api/list-post-columns?view=graph-rest-1.0&tabs=http