I want my timer job to display failed status on certain condition. Should I just throw an exception or what?
相关问题
- Sharepoint multiple connections to a web parts
- Trouble with OR in Sharepoint CAML
- List Microsoft Sharepoint Sites with Microsoft Gra
- How to use VBA or Powershell to export lists from
- redirect using itemreceiver sharepoint
相关文章
- File Upload to SharePoint 2013 using REST API
- Passing file object to Web API from Javascript
- How can I iterate recursively though a sharepoint
- SharePoint, VirtualPathProviders and Application R
- Saving a document to SharePoint brings up “Web Fil
- What does “wsse:InvalidSecurity” mean?
- SharePoint SOAP GetListItems VS jQuery - How to us
- Trying to upload files to subfolder in Sharepoint
Hasan,
If an exception bubbles out of the code, it will indeed show a failed status. If you want to explicitly "fail" your run with the timer job instance, you can and should throw an exception out. This can be done in conjunction with setting the
SPJobDefinition.Retry
flag value to TRUE if you feel that another run through would get around your "problem condition."By the same token, if you're trapping exceptions for logging purposes (e.g., to write additional detail out to the ULS logs -- never a bad idea), rethrow any exceptions you catch unless you truly compensate for them. You want to avoid eating exceptions just to avoid having exceptions bubble out for the reasons stated (exception status is tied to job success/failure reporting).
I hope that helps!