Exception
ExceptionType=System.InvalidOperationExceptionJSONMessage=Operation is not valid due to the current state of the object.
Cause:
I tried to call SPUtility.SendEmail within the RunWithElevatedPrivileges delegate.Comments
If i try to run this method out of Elevated delegate, it works fine. All the other things that are working fine in Elevated Privileges (except send email) are,Solution:
I found two solution/Work arounds ,- Remove elevation (Do not know why this option works).
- Set HttpContext.Current to null. Following is the detail discussion over why this option works.
https://johnatjornata.wordpress.com/2012/01/23/runwithelevatedprivileges-operation-is-not-valid-due-to-the-current-state-of-the-object-error-explained/
No comments:
Post a Comment