When creating an item, I delete the default permissions and grant permissions to about 40 groups and it gives me a timeout error.

Can I change the timeout? Is there a way to grant different permissions to 40 groups in a batch mode?

This is a legacy code and I have seen that for every permission granted it opens a new RunWithElevatedPrivileges - using new site()..., so it opens a context 40 times and I think that it should be done once, what do you think?

  • 1
    If you can still manipulate the code or rewrite your own, then running in RunWIthElevatedPrivileges shouldn't be a problem as long as you do everything inside that. Then again, maybe you could give some better explanation about your possibilities – Taurib Feb 9 '17 at 11:33
  • Hi Taurib, I can modify the code and my idea is to take everything inside RunWitheElevated instead of calling 40 times to a function that uses Runwithelevated – Luis Molina Feb 9 '17 at 12:28
  • 1
    I'd suggest you to collect all those groups to an array (List) and run them at once if you can. And use RunWIthElevatedPrivileges when going through that loop. I've had some problems, when using RunWIthElevatedPrivileges through multiple methods. – Taurib Feb 9 '17 at 13:07

You can change time Out from web.config file of you web

     <httpRuntime maxRequestLength="51200" requestValidationMode="2.0"    executionTimeout="999999" maxUrlLength="1024" />

Or you can used SPLongOperation if you created solution in VS

using (SPLongOperation longOperation = new SPLongOperation(this.Page))
     //Show Text for the Top Line on the screen.
     longOperation.LeadingHTML = "Working on it....";
     //Show text for the Bottom line on the screen.
     longOperation.TrailingHTML = "Please wait it will take few minuts";

     //Write you code here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.