SOLVED

CSOM Update without triggering workflow - SharePoint Online

Silver Contributor

I seem to recall someone saying / writing that updates were coming to SharePoint Online CSOM where you could update a list item without triggering workflows (like you can on prem), did that ever come to fruition?

11 Replies

Mmmm...first time I heard this, but I'm pretty sure @Vesa Juvonen will have the answer to this question

You mean webhooks i guess a new way of triggering events in lists
and hue.. it is not GA yet... only first release preview
No, i don't believe it was webhooks. It was definitely discussed on Yammer, can't find any record of it anywhere else.

This is apparently a thing in on premise, maybe in on prem CSOM it's called a SystemUpdate()

I believe it would allow you to run scripts without incrementing versioning or triggering workflows on item changes.

SystemUpdate is not available in CSOM on prem, it's only in the server side object model.  it allows you to update items without affecting last update user /time or running workflows.  It is meant to be used by trusted code.  I guess it's not in the csom because if it were, anyone who had update authority to a list would be able to make a simple ajax call from their browser and change the last update user/time or running any workflows, 

 

there would have to be some changes to the security model before they would ever allow this in the csom.

best response confirmed by VI_Migration (Silver Contributor)
Solution

Hi there,

 

SystemUpdate is presented in CSOM/JSOM too, actually. It was added in SPO sometime before and seems like it works very close to SSOM's method:

 

  • No editor and modified date information is updated,
  • No version is created,
  • But workflow with an on edit trigger, unfortunately, starts,
  • Not sure about RERs, likely they are fired as well.

 

Here is a sample in JavaScript (should be executed on classic display or edit form):

 

var clientContext = new SP.ClientContext.get_current(); 
var oList = clientContext.get_web().get_lists().getById(_spPageContextInfo.pageListId);
var oListItem = oList.getItemById(GetUrlKeyValue("ID"));
oListItem.set_item('Title', 'New title');
oListItem.systemUpdate();
clientContext.executeQueryAsync(
    function() {
        console.log('Item has been updated');
    },
    function(sender, args) {
        console.log('Error: ' + args.get_message() + ' ' + args.get_stackTrace());
    }
);

Didn't check if the CSOM (C#) behavior is the same.

Anyway, maybe it will be helpful.

Thanks for the info Andrew-- I had no Idea they added that to the CSOM!

Still seems like it could be a security issue if a user can update any metadata on a list without having temselves tagged as the last update user.

also thanks, i knew something like that was out there (shame tho I was more interested in bypassing the workflows), but still useful

I believe that a user should be a member of Site Owners or site collection admin to be able to execute systemUpdate.

Vesa mentioned on the PNP-JS call today that there was an update in the November CSOM release that would let you do a systemupdate from csom without triggering workflows.

@Andrew Koltyakov - Would you happen to know an all encompassing PS script that can be used to stop SP WFs, update user identities on the WF and then restart all SharePoint Workflows? We're in the process of migrating an online secure tenant to GCC SharePoint tenant and the user identity mappings are changing. So, I was looking to see if this is possible to do using a PowerShell script.  I've turned over many rocks during my online search, but can't seem to find a script that comes close to doing the described functions.

 

Thanks for any help or advise you can offer

Vincent T.

1 best response

Accepted Solutions
best response confirmed by VI_Migration (Silver Contributor)
Solution

Hi there,

 

SystemUpdate is presented in CSOM/JSOM too, actually. It was added in SPO sometime before and seems like it works very close to SSOM's method:

 

  • No editor and modified date information is updated,
  • No version is created,
  • But workflow with an on edit trigger, unfortunately, starts,
  • Not sure about RERs, likely they are fired as well.

 

Here is a sample in JavaScript (should be executed on classic display or edit form):

 

var clientContext = new SP.ClientContext.get_current(); 
var oList = clientContext.get_web().get_lists().getById(_spPageContextInfo.pageListId);
var oListItem = oList.getItemById(GetUrlKeyValue("ID"));
oListItem.set_item('Title', 'New title');
oListItem.systemUpdate();
clientContext.executeQueryAsync(
    function() {
        console.log('Item has been updated');
    },
    function(sender, args) {
        console.log('Error: ' + args.get_message() + ' ' + args.get_stackTrace());
    }
);

Didn't check if the CSOM (C#) behavior is the same.

Anyway, maybe it will be helpful.

View solution in original post