How do you use the ExplorerEvents_10_CloseEventHandler? - outlook

I want to run some code when the InLineResponse has closed. For example if the user was to use the addin to to pop out a reply for some code to get called when the inlineresponse closes.
I have looked found the following documentation explaining features which i believe would do the job.
https://learn.microsoft.com/en-us/office/vba/api/outlook.explorer.inlineresponseclose
https://learn.microsoft.com/en-us/dotnet/api/microsoft.office.interop.outlook.explorerevents_10_closeeventhandler?view=outlook-pia
However I am still unsure how to execute this in code.

Outlook.Explorer myExplorer = Globals.ThisAddIn.Application.ActiveExplorer();
((Outlook.ExplorerEvents_10_Event)myExplorer).InlineResponseClose+= new Outlook.ExplorerEvents_10_InlineResponseCloseEventHandler(Explorer_InlineResponseClose);
void Explorer_InlineResponseClose(){ // Code to run here}

Related

How to generate log in service now when a browser is closed?

I need to generate logs in service now whenever the browser is closed or the session is expired. I tried using global business rule but couldnt achieve it. It will be greatfull if i can if i get an idea to achieve this.
Thanks in advance.
I assume you already know how to generate a log and such in ServiceNow, and the problem you're having, is how to run code when the user closed their browser.
The best solution would probably be to create an onload client script which sets onbeforeunload to a function that triggers a log.
More on that here: https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload
For the second part of your question, user sessions are tracked in a "user sessions" table. If you want to also log when theirs expires, you can do so with a business rule on that table.
You can use
GlideAjax to call from your client script to a server side script include.
Look at GSLog
Try this one
var gl = new GSLog("com.snc.sla.tasksla.log", "TaskSLA");

Can we add custom action to HtmlLoggerState

I'm using VS2013/CodedUI and my palybacksetting is as follow:
Playback.PlaybackSettings.LoggerOverrideState = HtmlLoggerState.AllActionSnapshot;
I also have a 3rd party tool that I have integrated to my code that does some action that codedui can't...Iw an to be able to log those steps into the ActionLog.html file with where codedui capture the actions and screenshot.
I searched a lot but didn't find anything on how we can achieve this.
thanks in advance for any help
I posted a response over here: Writing Custom HTML Logs
It sounds like there's not a good way to do this. You can get the path to where the html file lives and write a custom logger from there. I'm not sure it'd be safe to try and write to it while your test is executing, but perhaps once your test is complete.

Selenium Webdriver/TestNG/Maven/Xvfb - take screenshot on fail?

wanted to ask you about the best way to take screenshot on fail in such project?
Should I do it in the Selenium code, or in the Maven project via some command or with Xvfb?
Im using Firefox headless via Xvfb.
I have seen a few classes on the internet that take screenshots, but Im missing the big picture here.
How does this class know when to take the screenshot?
How does Jenkins tell the java test code that it has failed, so it will take a picture?
Where in the test code should I reference the take screenshot class?
Should I use a try catch on the whole test?
Isnt there a Jenkins plugin that will automatically save screenshot on fail?
I just found an article that explains a much better way to do it: http://darrellgrainger.blogspot.com/2011/02/generating-screen-capture-on-exception.html
How does it work?
Effectively, you pass in a custom WebDriverEventListener, which has functions that will be called on certain events. One of those events is onException(). So every time an exception is thrown by WebDriver, you can write the code to take a screenshot.
I have seen three different ways to do this:
If you have a static driver, the easiest way is to set up a listener in TestNG (Overridding TestListenerAdapter), and then to take a screenshot in the onTestFailure() method.
My personal method is to use the Selenium Page Object pattern, but modified a bit. I have created an EnhancedWebElement object that wraps and extends a normal WebElement, and has a reference to the driver. Then in each of the methods that WebElement has, I perform the call in a try/catch and in the catch, I then take a screenshot. I'm open to sharing the code, but I'd have to trim away quite a bit to post here, so please tell me if you want to see it.
Alternatively, you can set up a proxy around the WebElement or the Driver itself and have it catch everything. I haven't done this, but I've seen it work on other projects.
just found an article that explains a much better way to do it: http://darrellgrainger.blogspot.com/2011/02/generating-screen-capture-on-exception.html
Blockquote
But this dicision have some problem. it will save screenshoot on any exception even when you try/catch some in your code.
I use methods from that article. But in my testng.xml files i add
`
<listeners>
<listener class-name="MyListener" />
</listeners>
`
And than i create
`
public class MyListener implements ITestListener{
//almost all methods i create blank
//but implement only onTestFailure
//
onTestFailure(){
//here i used methods from article ubove
//
}
}
`
And screenshots done only in case when my #Test fail.

Windows SendTo from script

I'm writing an application where I have to send an email with an attachment using the default mail application.
Before the email is sent, I want the user to be able to edit the text, i.e. the application should just open the mail client with pre-filled recipient and attachment and give the user the opportunity to send it.
At very minimum I need the same effect I'd got if I selected "SendTo/Mail Recipient" from the context menu of the file.
Solutions based on the "mailto:" trick won't work as there are mail clients that do not support the "attachment=" part.
The most complete solution I've found is this one:
http://www.codeproject.com/Articles/3839/SendTo-mail-recipient
but it seems a lot of code for something so simple! (and also crashes when compiled with VS2008)
Is there any other option? It would be ok even if it was an external tool or script (e.g. a .vbs script to be launched with cscript).
I would advise you to use MAPI (Messaging Application Program Interface).
If dotNet can be part of the solution, here's a ready-to-use class in C# : Class for creating MAPI Mail Messages. It would give you something like this:
MapiMailMessage message = new MapiMailMessage("Test Message", "Test Body");
message.Recipients.Add("Test#Test.com");
message.Files.Add(#"C:\del.txt");
message.ShowDialog();
Otherwise, you can always do it in C++ if you feel confortable with it, like this answer suggest.
Then, you will be able to ShellExecute the binary executable and pass it some parameters.
Hope this helps :-)

How to trace CakePHP's inner workflow

Short description
I'm getting used to CakePHP right now and am wondering about how to get more debug-information about what is happening inside the framework.
Let me please explain my situation a little more detailed
As you know CakePHP does a lot for you without putting you into the need to write additional code. One example is the handling of models.
I just created a model User and added validation-rules (no other methods). As described in the API methods like save will just work.
After that I created the needed controller and view to add a new user. When I try to add a user from the view I just receive the flash-message The user could not be created. Please, try again. No validation-violations are flashed.
I also did set the debug-level to 2: Configure::write('debug', 2); but do not receive any errors. The error.log inside \tmp\logs is also empty.
I really do want to learn how to solve those issues in the future.
So what else can I do to debug / display inner processes of cake?
Thank you very much for your help!
DebugKit is an official plugin that gives you lots of information on the request, queries and variables produced by Cake:
https://github.com/cakephp/debug_kit
You can also use trace() and other methods in the Debugger to show what is being executed in the background:
http://book.cakephp.org/2.0/en/development/debugging.html
Use a PHP IDE with an integrated debugger. That will allow you to follow execution line by line as it is executed and even inspect variable values as you go. Netbeans is a free one.

Resources