Forum Discussion
johnjohn-Peter
Feb 12, 2025Iron Contributor
Set Unique value based on the (CreatedDate & CreatedBy)
We want to create a SharePoint online custom list with these business logic:- Users enter an entry each day to specify their location (which site they are working in).. No one can see other entrie...
ArefHalmstrand
Feb 12, 2025Steel Contributor
Hello,
I suggest that you create a custom content type for your data within the list.
Edit the +New button on the list to not allow creation of that new content type (preventing users to create items from the list)
Create a Power App that allows users to add data to the list (with the right content type).
Add functionality to the Power App to see if the current user has an item with the same date as today.
If yes, add custom status message and disable the create button.
If no, allow the user to add the information and save to the list.
Yours sincerely,
Aref Halmstrand
If this was helpful, please mark as resolved 🙂
Feel free to like this post as well 🤩
johnjohn-Peter
Feb 13, 2025Iron Contributor
but this will not prevent users from modifying the list through the api or using their own power apps
- Rob_ElliottFeb 14, 2025Bronze Contributor
You are over-thinking this. Why on earth would users build their own app to change a list they don't know the address of, and why would they be using an api? You are making this so much harder than it needs to be.
- ArefHalmstrandFeb 13, 2025Steel Contributor
Hello,
Yes it will :)
Because to access the content type, you have to know the ID.
The ID should not be accessible for the regular end-users.- johnjohn-PeterFeb 13, 2025Iron Contributor
but what custom content type have to do with this? i mean any list will have a default list content type. so you mean the default list content type id is exposed to end users unlike custom content types ids? by the way i always create site content types and add the columns there, but never thought that using custom content type will provide a secure way to prevent modifying the list using API
- ArefHalmstrandFeb 14, 2025Steel Contributor
Exactly,
If you try to create a list item, either through the interface or API, it will default try to create an object with the content type "Item". However, if you are only working with a custom content type, then the users will never be able to "guess" the content type ID and actually create a real item.
You can look at it this way: if they try to go the wrong way, you will notice it as spam.
The idea is not to remove the default content type. It has to coexist with the custom content type. Just make it hidden on the +new button and make sure content type is not shown as an editable field anywhere.
Yours sincerely,
Aref HalmstrandPlease mark as resolved if this was helpful 🙂
Feel free to like this post 🤩