SOLVED

CSOM Update without triggering workflow - SharePoint Online

%3CLINGO-SUB%20id%3D%22lingo-sub-33886%22%20slang%3D%22en-US%22%3ECSOM%20Update%20without%20triggering%20workflow%20-%20SharePoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-33886%22%20slang%3D%22en-US%22%3E%3CP%3EI%20seem%20to%20recall%20someone%20saying%20%2F%20writing%20that%20updates%20were%20coming%20to%20SharePoint%20Online%20CSOM%20where%20you%20could%20update%20a%20list%20item%20without%20triggering%20workflows%20(like%20you%20can%20on%20prem)%2C%20did%20that%20ever%20come%20to%20fruition%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-33886%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-401232%22%20slang%3D%22en-US%22%3ERe%3A%20CSOM%20Update%20without%20triggering%20workflow%20-%20SharePoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-401232%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F29128%22%20target%3D%22_blank%22%3E%40Andrew%20Koltyakov%3C%2FA%3E%26nbsp%3B-%20Would%20you%20happen%20to%20know%20an%20all%20encompassing%20PS%20script%20that%20can%20be%20used%20to%20stop%20SP%20WFs%2C%20update%20user%20identities%20on%20the%20WF%20and%20then%20restart%20all%20SharePoint%20Workflows%3F%20We're%20in%20the%20process%20of%20migrating%20an%20online%20secure%20tenant%20to%20GCC%20SharePoint%20tenant%20and%20the%20user%20identity%20mappings%20are%20changing.%20So%2C%20I%20was%20looking%20to%20see%20if%20this%20is%20possible%20to%20do%20using%20a%20PowerShell%20script.%26nbsp%3B%20I've%20turned%20over%20many%20rocks%20during%20my%20online%20search%2C%20but%20can't%20seem%20to%20find%20a%20script%20that%20comes%20close%20to%20doing%20the%20described%20functions.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20any%20help%20or%20advise%20you%20can%20offer%3C%2FP%3E%3CP%3EVincent%20T.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-34686%22%20slang%3D%22en-US%22%3ERE%3A%20CSOM%20Update%20without%20triggering%20workflow%20-%20SharePoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-34686%22%20slang%3D%22en-US%22%3EVesa%20mentioned%20on%20the%20PNP-JS%20call%20today%20that%20there%20was%20an%20update%20in%20the%20November%20CSOM%20release%20that%20would%20let%20you%20do%20a%20systemupdate%20from%20csom%20without%20triggering%20workflows.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-34415%22%20slang%3D%22en-US%22%3ERe%3A%20CSOM%20Update%20without%20triggering%20workflow%20-%20SharePoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-34415%22%20slang%3D%22en-US%22%3E%3CP%3EI%20believe%20that%20a%20user%20should%20be%20a%20member%20of%20Site%20Owners%20or%20site%20collection%20admin%20to%20be%20able%20to%20execute%20systemUpdate.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-34414%22%20slang%3D%22en-US%22%3ERe%3A%20CSOM%20Update%20without%20triggering%20workflow%20-%20SharePoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-34414%22%20slang%3D%22en-US%22%3Ealso%20thanks%2C%20i%20knew%20something%20like%20that%20was%20out%20there%20(shame%20tho%20I%20was%20more%20interested%20in%20bypassing%20the%20workflows)%2C%20but%20still%20useful%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-34411%22%20slang%3D%22en-US%22%3ERe%3A%20CSOM%20Update%20without%20triggering%20workflow%20-%20SharePoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-34411%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20the%20info%20Andrew--%20I%20had%20no%20Idea%20they%20added%20that%20to%20the%20CSOM!%3C%2FP%3E%3CP%3EStill%20seems%20like%20it%20could%20be%20a%20security%20issue%20if%20a%20user%20can%20update%20any%20metadata%20on%20a%20list%20without%20having%20temselves%20tagged%20as%20the%20last%20update%20user.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-34333%22%20slang%3D%22en-US%22%3ERe%3A%20CSOM%20Update%20without%20triggering%20workflow%20-%20SharePoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-34333%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20there%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESystemUpdate%20is%20presented%20in%26nbsp%3BCSOM%2FJSOM%20too%2C%20actually.%20It%20was%20added%20in%20SPO%20sometime%20before%20and%20seems%20like%20it%20works%20very%20close%20to%20SSOM's%20method%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3ENo%20editor%20and%20modified%20date%20information%20is%20updated%2C%3C%2FLI%3E%3CLI%3ENo%20version%20is%20created%2C%3C%2FLI%3E%3CLI%3EBut%20workflow%20with%20an%20on%20edit%20trigger%2C%26nbsp%3Bunfortunately%2C%20starts%2C%3C%2FLI%3E%3CLI%3ENot%20sure%20about%20RERs%2C%20likely%20they%20are%20fired%20as%20well.%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere%20is%20a%20sample%20in%20JavaScript%20(should%20be%20executed%20on%20classic%20display%20or%20edit%20form)%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3Evar%20clientContext%20%3D%20new%20SP.ClientContext.get_current()%3B%20%0Avar%20oList%20%3D%20clientContext.get_web().get_lists().getById(_spPageContextInfo.pageListId)%3B%0Avar%20oListItem%20%3D%20oList.getItemById(GetUrlKeyValue(%22ID%22))%3B%0AoListItem.set_item('Title'%2C%20'New%20title')%3B%0AoListItem.systemUpdate()%3B%0AclientContext.executeQueryAsync(%0A%20%20%20%20function()%20%7B%0A%20%20%20%20%20%20%20%20console.log('Item%20has%20been%20updated')%3B%0A%20%20%20%20%7D%2C%0A%20%20%20%20function(sender%2C%20args)%20%7B%0A%20%20%20%20%20%20%20%20console.log('Error%3A%20'%20%2B%20args.get_message()%20%2B%20'%20'%20%2B%20args.get_stackTrace())%3B%0A%20%20%20%20%7D%0A)%3B%3C%2FPRE%3E%3CP%3EDidn't%20check%20if%20the%20CSOM%20(C%23)%20behavior%26nbsp%3Bis%20the%20same.%3C%2FP%3E%3CP%3EAnyway%2C%20maybe%20it%20will%20be%20helpful.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-34268%22%20slang%3D%22en-US%22%3ERe%3A%20RE%3A%20CSOM%20Update%20without%20triggering%20workflow%20-%20SharePoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-34268%22%20slang%3D%22en-US%22%3E%3CP%3ESystemUpdate%20is%20not%20available%20in%20CSOM%20on%20prem%2C%20it's%20only%20in%20the%20server%20side%20object%20model.%20%26nbsp%3Bit%20allows%20you%20to%20update%20items%20without%20affecting%20last%20update%20user%20%2Ftime%20or%20running%20workflows.%20%26nbsp%3BIt%20is%20meant%20to%20be%20used%20by%20trusted%20code.%20%26nbsp%3BI%20guess%20it's%20not%20in%20the%20csom%20because%20if%20it%20were%2C%20anyone%20who%20had%20update%20authority%20to%20a%20list%20would%20be%20able%20to%20make%20a%20simple%20ajax%20call%20from%20their%20browser%20and%20change%20the%20last%20update%20user%2Ftime%20or%20running%20any%20workflows%2C%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethere%20would%20have%20to%20be%20some%20changes%20to%20the%20security%20model%20before%20they%20would%20ever%20allow%20this%20in%20the%20csom.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-34174%22%20slang%3D%22en-US%22%3ERe%3A%20RE%3A%20CSOM%20Update%20without%20triggering%20workflow%20-%20SharePoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-34174%22%20slang%3D%22en-US%22%3ENo%2C%20i%20don't%20believe%20it%20was%20webhooks.%20It%20was%20definitely%20discussed%20on%20Yammer%2C%20can't%20find%20any%20record%20of%20it%20anywhere%20else.%3CBR%20%2F%3E%3CBR%20%2F%3EThis%20is%20apparently%20a%20thing%20in%20on%20premise%2C%20maybe%20in%20on%20prem%20CSOM%20it's%20called%20a%20SystemUpdate()%3CBR%20%2F%3E%3CBR%20%2F%3EI%20believe%20it%20would%20allow%20you%20to%20run%20scripts%20without%20incrementing%20versioning%20or%20triggering%20workflows%20on%20item%20changes.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-33938%22%20slang%3D%22en-US%22%3ERE%3A%20CSOM%20Update%20without%20triggering%20workflow%20-%20SharePoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-33938%22%20slang%3D%22en-US%22%3Eand%20hue..%20it%20is%20not%20GA%20yet...%20only%20first%20release%20preview%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-33937%22%20slang%3D%22en-US%22%3ERE%3A%20CSOM%20Update%20without%20triggering%20workflow%20-%20SharePoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-33937%22%20slang%3D%22en-US%22%3EYou%20mean%20webhooks%20i%20guess%20a%20new%20way%20of%20triggering%20events%20in%20lists%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-33887%22%20slang%3D%22en-US%22%3ERe%3A%20CSOM%20Update%20without%20triggering%20workflow%20-%20SharePoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-33887%22%20slang%3D%22en-US%22%3E%3CP%3EMmmm...first%20time%20I%20heard%20this%2C%20but%20I'm%20pretty%20sure%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F369%22%20target%3D%22_blank%22%3E%40Vesa%20Juvonen%3C%2FA%3E%26nbsp%3Bwill%20have%20the%20answer%20to%20this%20question%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Valued 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
Highlighted

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

Highlighted
You mean webhooks i guess a new way of triggering events in lists
Highlighted
and hue.. it is not GA yet... only first release preview
Highlighted
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.
Highlighted

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.

Highlighted
Best Response confirmed by Brent Ellis (Valued 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.

Highlighted

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.

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

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

Highlighted
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.
Highlighted

@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.