Jun 14, 2018 Requirement: Bulk Update SharePoint Online List Items using PowerShell How to Update Large Number of List Items in Bulk using PowerShell? While lists items can be updated using the approach in my another post, Update SharePoint Online List using PowerShell, How about updating large lists with more than 5000 list items? Well, large lists must be.
- Products
Today I want to provide a useful SharePoint PowerShell script that allows you to update properties of a list item or a document without changing the Modified or Modified by fields and without firing any event receiver or workflow.
In this example I have only changed the title of the first item in my list.
It’s important to set EventFiringDisabled to true if you don’t want event receivers or workflows to be executed. To do this I used reflection to set the internal static property of the SPEventManager class.
It is also important to use SystemUpdate instead of Update because this updates the database with changes that are made to the list item without changing the Modified or Modified By fields.
Stay updated
We will provide you with information about new products and updates.
Need help?
If you have any questions about our products or services, let us know.
e-mail: [email protected]
or call us: +43 1 236 19 03 - 0
(9AM-6PM CET)
(9AM-6PM CET)
Follow us!
Keep yourself informed about our products, company news and helpful blog posts.
-->Syntax
Examples
------------------EXAMPLE 1------------------
Sets fields value in the list item with ID 1 in the 'Demo List'. It sets both the Title and Category fields with the specified values. Notice, use the internal names of fields.
------------------EXAMPLE 2------------------
Sets fields value in the list item with ID 1 in the 'Demo List'. It sets the content type of the item to 'Company' and it sets both the Title and Category fields with the specified values. Notice, use the internal names of fields.
------------------EXAMPLE 3------------------
Sets fields value in the list item which has been retrieved by for instance Get-PnPListItem. It sets the content type of the item to 'Company' and it sets both the Title and Category fields with the specified values. Notice, use the internal names of fields.
------------------EXAMPLE 4------------------
Sets the retention label in the list item with ID 1 in the 'Demo List'.
Parameters
-Connection
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.
Type: | SPOnlineConnection |
Position: | Named |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specify either the name, ID or an actual content type
Type: | ContentTypePipeBind |
Position: | Named |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The ID of the listitem, or actual ListItem object
Type: | ListItemPipeBind |
Position: | Named |
Accept pipeline input: | True |
Accept wildcard characters: | False |
The name of the retention label.
![Sharepoint Update List Item Power Shell Sharepoint Update List Item Power Shell](/uploads/1/2/5/8/125876375/641369316.png)
Only applicable to: SharePoint Online
Type: | String |
Position: | Named |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The ID, Title or Url of the list.
Type: | ListPipeBind |
Position: | 0 |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Update the item without creating a new version.
Only applicable to: SharePoint Online
Type: | SwitchParameter |
Position: | Named |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Use the internal names of the fields when specifying field names.
Single line of text: -Values @{'TextField' = 'Title New'}
Multiple lines of text: -Values @{'MultiTextField' = 'New textnnMore text'}
Rich text: -Values @{'MultiTextField' = '<strong>New</strong> text'}
Choice: -Values @{'ChoiceField' = 'Value 1'}
Number: -Values @{'NumberField' = '10'}
Currency: -Values @{'NumberField' = '10'}
Currency: -Values @{'CurrencyField' = '10'}
Date and Time: -Values @{'DateAndTimeField' = '03/13/2015 14:16'}
Lookup (id of lookup value): -Values @{'LookupField' = '2'}
Multi value lookup (id of lookup values as array 1): -Values @{'MultiLookupField' = '1','2'}
Multi value lookup (id of lookup values as array 2): -Values @{'MultiLookupField' = 1,2}
Multi value lookup (id of lookup values as string): -Values @{'MultiLookupField' = '1,2'}
Yes/No: -Values @{'YesNoField' = $false}
Person/Group (id of user/group in Site User Info List or email of the user, separate multiple values with a comma): -Values @{'PersonField' = '[email protected]','21'}
Managed Metadata (single value with path to term): -Values @{'MetadataField' = 'CORPORATE|DEPARTMENTS|FINANCE'}
Managed Metadata (single value with id of term): -Values @{'MetadataField' = 'fe40a95b-2144-4fa2-b82a-0b3d0299d818'} with Id of term
Managed Metadata (multiple values with paths to terms): -Values @{'MetadataField' = ('CORPORATE|DEPARTMENTS|FINANCE','CORPORATE|DEPARTMENTS|HR')}
Managed Metadata (multiple values with ids of terms): -Values @{'MetadataField' = ('fe40a95b-2144-4fa2-b82a-0b3d0299d818','52d88107-c2a8-4bf0-adfa-04bc2305b593')}
Hyperlink or Picture: -Values @{'HyperlinkField' = 'https://github.com/OfficeDev/, OfficePnp'}
Type: | Hashtable |
Position: | Named |
Accept pipeline input: | False |
Accept wildcard characters: | False |
This parameter allows you to optionally apply the cmdlet action to a subweb within the current web. In most situations this parameter is not required and you can connect to the subweb using Connect-PnPOnline instead. Specify the GUID, server relative url (i.e. /sites/team1) or web instance of the web to apply the command to. Omit this parameter to use the current web.
Type: | WebPipeBind |
Position: | Named |
Accept pipeline input: | False |
Accept wildcard characters: | False |
![List List](http://www.appzinside.com/wp-content/uploads/2016/03/powershell.png)
Outputs
Microsoft.SharePoint.Client.ListItem