Prevent add/edit documents and items inside certain site collections if accessed from SP mobile app

%3CLINGO-SUB%20id%3D%22lingo-sub-784089%22%20slang%3D%22en-US%22%3EPrevent%20add%2Fedit%20documents%20and%20items%20inside%20certain%20site%20collections%20if%20accessed%20from%20SP%20mobile%20app%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-784089%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20facing%20this%20sever%20problem%20which%20i%20were%20not%20aware%20of%20inside%20our%20sharepoint%20online%20site%20collection%2Fs.%20Now%20on%20some%20sharepoint%20online%20site%20collections%2C%20i%20have%20added%20some%20custom%20lists%2C%20and%20inside%20the%20custom%20lists'%20New%20and%20Edit%20list%20forms%20i%20have%20added%20some%20scripts%20(using%20the%20script%20editor%20web%20part)%2C%20the%20script%20will%20hide%2Fshow%20some%20fields%20based%20on%20other%20fields.%20and%20everything%20was%20working%20well.%20here%20is%20part%20of%20the%20script%20inside%20the%20list%20Edit%20form%3A-%3C%2FP%3E%3CPRE%3E%3CU%3E%3CSPAN%20class%3D%22tag%22%3E%3CSCRIPT%3E%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%20%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22atn%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3Bsrc%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pun%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%3D%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22atv%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%22%2FResources%2Fjquery-1.11.3.js%22%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22tag%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%3C%2FSCRIPT%3E%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22tag%22%3E%3CSCRIPT%3E%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pln%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%24(function()%20%7B%0A%20%20%24(%22input%5Bid%5E%3D'ProjectEstimated_'%5D%22).attr('disabled'%2C%20'disabled')%3B%0A%20%20%24(%22img%5Bid%5E%3D'ProjectEstimated_'%5D%22).hide()%3B%0A%20%20%24(%22input%5Bid%5E%3D'ProjectEstimatedCompletion_'%5D%22).attr('disabled'%2C%20'disabled')%3B%0A%20%20%24(%22img%5Bid%5E%3D'ProjectEstimatedCompletion_'%5D%22).hide()%3B%3B%0A%0A%2F%2Fcode%20goes%20here%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FU%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FPRE%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BToday%20i%20download%20the%20sharepoint%20mobile%20app%20on%20my%20iPhone%20%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%20i%20access%20the%20sites%20using%20the%20SP%20app%2C%20but%20i%20have%20noted%20these%20problems%3A-%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B1.%20the%20above%20custom%20script%20will%20not%20have%20any%20effect%2C%20so%20now%20when%20editing%20an%20item%20inside%20SP%20mobile%20app%20%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%20all%20the%20fields%20will%20be%20shown.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B2.%20I%20have%20a%20managed%20metadata%20field%20%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%20and%20this%20field%20will%20be%20shown%20as%20read-only%20inside%20SP%20mobile%20app.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B3.%20Using%20PnP%20i%20have%20defined%20to%20hide%20some%20fields%20inside%20the%20New%20and%20Edit%20forms%2C%20as%20follow%3A-%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BU%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%24fieldTitle%20%3D%20%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bquot%3BSiteCreated%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bquot%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FU%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BU%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%24customfield%20%3D%20%24Context.Site.RootWeb.Fields.GetByInternalNameOrTitle(%24fieldTitle)%20%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FU%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BU%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%24customfield.SetShowInEditForm(%24true)%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FU%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BU%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%24customfield.SetShowInNewForm(%24false)%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FU%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BU%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%24customfield.UpdateAndPushChanges(%24true)%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FU%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3Bbut%20those%20settings%20will%20not%20have%20any%20effect%2C%20and%20all%20the%20fields%20will%20be%20shown%20on%20SP%20mobile%20app%20!!!%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B4.%20i%20have%20disabled%20attaching%20files%20inside%20the%20custom%20list%20settings%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%20but%20when%20add%2Fedit%20items%20inside%20SP%20mobile%20app%20users%20can%20attach%20files%20to%20the%20items..%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bnbsp%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BSo%20can%20anyone%20adivce%20how%20i%20can%20have%20a%20short%20term%20fix%2C%20by%20either%3A-%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B1.%20prevent%20accessing%20some%20site%20collection%20on%20mobile%20apps%3F%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B2.%20prevent%20add%20or%20edit%20items%20and%20document%20on%20mobile%20apps%2C%20and%20only%20allow%20users%20to%20view%20the%20items%20and%20documents%3F%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3Bany%20help%20on%20this%20will%20be%20highly%20appreciated.%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BThanks%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Flingo-body%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Blingo-labs%20id%3D%22lingo-labs-784089%22%20slang%3D%22en-US%22%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Blingo-label%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BAdmin%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Flingo-label%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Blingo-label%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BDeveloper%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Flingo-label%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Blingo-label%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3Bmobile%20app%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Flingo-label%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3Blingo-label%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3BSharePoint%20Online%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Flingo-label%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Blt%3B%2Flingo-labs%26amp%3Bamp%3Bamp%3Bamp%3Bgt%3B%3C%2FSCRIPT%3E%3C%2FSPAN%3E%3C%2FU%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Valued Contributor

I am facing this sever problem which i were not aware of inside our sharepoint online site collection/s. Now on some sharepoint online site collections, i have added some custom lists, and inside the custom lists' New and Edit list forms i have added some scripts (using the script editor web part), the script will hide/show some fields based on other fields. and everything was working well. here is part of the script inside the list Edit form:-

<script src="/Resources/jquery-1.11.3.js"></script>
<script>$(function() {
  $("input[id^='ProjectEstimated_']").attr('disabled', 'disabled');
  $("img[id^='ProjectEstimated_']").hide();
  $("input[id^='ProjectEstimatedCompletion_']").attr('disabled', 'disabled');
  $("img[id^='ProjectEstimatedCompletion_']").hide();;

//code goes here

 

Today i download the sharepoint mobile app on my iPhone >> i access the sites using the SP app, but i have noted these problems:-

 

1. the above custom script will not have any effect, so now when editing an item inside SP mobile app >> all the fields will be shown.

2. I have a managed metadata field >> and this field will be shown as read-only inside SP mobile app.

3. Using PnP i have defined to hide some fields inside the New and Edit forms, as follow:-

$fieldTitle = "SiteCreated"
$customfield = $Context.Site.RootWeb.Fields.GetByInternalNameOrTitle($fieldTitle)
$customfield.SetShowInEditForm($true)
$customfield.SetShowInNewForm($false)
$customfield.UpdateAndPushChanges($true)

 

but those settings will not have any effect, and all the fields will be shown on SP mobile app !!!

 

4. i have disabled attaching files inside the custom list settings>> but when add/edit items inside SP mobile app users can attach files to the items..

 

So can anyone adivce how i can have a short term fix, by either:-

1. prevent accessing some site collection on mobile apps?

2. prevent add or edit items and document on mobile apps, and only allow users to view the items and documents?

any help on this will be highly appreciated.

Thanks

0 Replies