Is there a way to trigger an action in Microsoft Flow (Power Automate) when just one specific file in SharePoint gets modified? At the moment I have the situation that 6 files are updated at once, so the same action is triggered 6 times in a row.
I use the trigger "When an item is created or modified". There I can only adjust the SharePoint site name and the list (library) of files to monitor.
Make sure your settings are set in a way the flow don't run in parallel.
In essence, you may want to limit the concurrence of the flow so it will run just once at a time.
1) First go to the settings
2) Limit the paralellism. If you just want to work on the first item then click turn on Split On which will yield a single file.
You can check here for more details.
Related
We have SharePoint Online site with list. Users can add, edit and delete own items in this list.
How I can resolve new issue - Users can't edit and delete own items older than one week (from creation date).
Is it possible without coding Remote Event Reciever or Azure function?
Per my knowledge, there is not an OOTB way to achieve it, we have to write some custom code.
If you only want to the user can't see some items in list view base on some condition, we can use list view Filter to achieve it. Note:User also access item form through URL.
I suggest you use remote event receiver or azure function to achieve this requirement.
In classic site, we can also add some JavaScript code into master page to prevent users access edit form page and hide the delete button in the page.
For this kind of requirement the solution which is 'no code' and with SP online is Power automate (previously MS Flow).
The best option in Your case would be to create a recurring flow which for example starts every day at 00:10 AM -> please see MS docs with description how to do this.
The Flow should get all items from a specific list for a specific site. You can do that with the 'Get Items' step. After that You can use the 'Apply to each' Step to check each item creation date with a 'Condition' Step. When some item will be older than one week You can use additional steps to break permission inheritance on item and remove all groups from permissions on this item or change the permissions on item from edit to read. Here I found an interesting article where are some predefined steps shown how to remove all permissions, remove and add a group. To tell You the truth I was not aware there already are this kind of steps in Power automate (maybe something new :) ) .
I would use SharePoint HTTP request and use SharePoint API to remove permissions on item and change some group role from edit to read. So I would do a similar procedure like here the only difference is not to break permission on all list but just on a specific item which I would get by ID. You can do all of those API request with a 'SharePoint HTTP request' Step
Please be aware there usually is a 5 000 unique permission levels threshold (50 000 is in on-prem) in list (place check here for latest info on limits in SP Online). So a better option would be to create a folder with view only permissions for the users before and when an item is older than one week You could only move this item to that folder also with Power Automate. That way all the files (items) in this folder would be read only and You would have only one unique item scope in this list and not as many as the old items.
Some other options You could use are:
Also code solution, but not RER and Azure function, would be to create a console app that uses CSOM to look through items in this list and either breaks permission on each item or moves to a folder (like the flow) and schedule this CSOM app on some local or remote server in Task Scheduler... Of Course You would need some local (or other) server for it which is always up and running :)
If You would like to use some 'little coding' and by any chance You are still using classic UI (not modern) You could use JSLink attached to CT or some column like Title and block editing of fields in edit forms etc (this is not the best option as always the users may create a view without a columns with this JSLink and go around this or modify the item using CSOM or Rest API)
You might consider using PowerApps (In case you have it configured in your subscription) to customize the edit form,
Then you use the validate() method, and disable a user from submitting the form in case ("Created" + 7 days) <= Today() or something like that.
I wanted to move items from a custom list in SharePoint 2013 with content type "item" to another list after a specific period (retention expiration). But the transfer to another location involving drop off library supports document libraries only. Please suggest any alternatives to implement this. Thanks
I would either recommend a workflow which is kicked off when the item is added to the list and as Max said have a delayed action, or some sort of wait until the retention date before processing the move. Things to be careful of is the retention date needs to be set in the future otherwise the move will process almost immediately, how you deal with the retention date changing.
Alternatively you could write a custom timer job which would go through all the items and check the retention date and if it is in the past move the file programmatically. The problem with this version is there is going to be a delay depending on how often you run the timer job.
Cheers
Truez
Drop off library is the default destination, in order to change this go to
Site Settings > Content Organizer Rules
Then create a new Rule specifying your Content type and finally Target Location choose your new custom destination that can support your specific content type
I build a plugin that runs in account update message that makes some validation not to duplicate the record. But if I try to disable that account or merge with another one it triggers the plugin.
How can I tell if the plugin was triggered by an activate/deactivate/merge action, or event mode like the one in CRM Dynamics 2011 Save Event Arguments Reference?
To add to Pete Oakey's answer, you can actually tell your plugin to fire only when certain fields are changed at the registration phase, in addition to testing this in actual code # runtime, by changing the "Filtering Attributes" of the plugin step. So unless your validation logic specifically needs the StateCode/StatusCode attributes to correctly process, you can filter those two attributes out, or just include the attributes your validation logic needs.
Original answer:
I believe you can reference the IExecutionContext.Depth Property of the IPluginExecutionContext object.
Every time a running plug-in or Workflow issues a message request to
the Web services that triggers another plug-in or Workflow to execute,
the Depth property of the execution context is increased. If the depth
property increments to its maximum value within the configured time
limit, the platform considers this behavior an infinite loop and
further plug-in or Workflow execution is aborted. The maximum depth
(8) and time limit (one hour) are configurable by the Microsoft
Dynamics CRM administrator.
So you can use an if statement to check if Depth > 1.
One way would be to compare the before and after values of what's changed on the account entity in the plugin. For example if you have only have active (if that's the right property name) in the values - you can look at the after value to see what's happened.
Another way would be to add a specific plugin for these messages and set some property/flag which you can check in the update plugin. Obviously this would have to run before the update plugin.
I have list that having data stores dynamically once the infopath form has been submitted. I want to archive this data after 30 days of creation date of any data. can you please suggest how would i do this. see i can do this by workflow but how can i set the condition that once 30 days complete after creation of any list it will automatically copy into other list.
First I would want to question WHY you want to move it to another list?
Why not simply setup a view on your main list showing only records created in last 30 days :-
Created >= [Today]-30
(And yes, you can use Today in view filters)
The best way to proceed is to create a timer job and define the criteria (like when should it be running) while creating the job. We have a very helpful post by SharePoint MVP here on how to create custom jobs. Note, you can test the job and business logic for shorter duration and if it works fine, you can simply extend the job duration for 30 days.
Its very simple, all you have to do is to define your 'copying list' logic in the Execute method of job class.
Good luck
I believe you can simply use standard out-of-the-box workflow activities to do this - no need for timer jobs or console apps.
Using SharePoint Designer, create a new workflow (New -> SP Content -> Workflow). Specify the list to attach the workflow to.
Specify that the workflow should start on item creation only.
In the first Step, add an action: Pause for duration. Make the duration 30 days.
Add another action: Copy list item. Specify the list to copy to.
Optionally: create a third action: Delete list item if you want the original item to be deleted from the original list.
And I think that's it :)
you have to crate a timer job which runs daily and move the items which are one month old
Potentially the easiest solution is to create a console application that you schedule to run on the SharePoint server (an alternative to creating a timer job).
Depending on how you want to archive the data, you could:
Get the list items (probably using GetItems), save them to a file or a DB, and delete the old items
Use custom STSADM commands to export the list (backup just the list)
Backup the entire site using STSADM
There's a limit on number of items in a list of 5000 items and if you change this in administration you'll kill performance. There are perfectly valid reasons to want to archive old items off of a rapidly growing list. exceeds the list view threshold 5000 items in Sharepoint 2010
I need to trigger alert, if value of particular column (say marks<8, send mail to manager) changes.
What should I do?
Some kinds of lists (e.g. tasks) allow to send alerts when someone changes an item that appears in a particular view. Read the article Use SharePoint Filtered Views to Stop Sending Alerts to Yourself to get all the details (appropriate section begins with Well you need to set up a filtered view).
If you list supports this feature, first create a view that shows only the items that satisfy your marks<8 condition and then configure an alert that uses this view.
You can implement an event handler on the list to do this :
http://www.c-sharpcorner.com/UploadFile/Chandresh.P/EventHandler04292009070324AM/EventHandler.aspx