How to remove attachments in outlook

Best practices, code snippets for common functionality, examples, and guidelines.
Simran
Posts: 8
Joined: Thu Nov 02, 2017 9:03 pm

How to remove attachments in outlook

Post by Simran » Tue Nov 28, 2017 6:47 pm

Hi,

I want to remove attachments from outlook. the code I used is:

Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'textInfo' at 270;6.", textInfo);
textInfo.FindAdapter<Text>().Click("270;6");
Report.Log(ReportLevel.Info, "Keyboard", "Key sequence '{Back}' with focus on 'textInfo'.", textInfo);
textInfo.FindAdapter<Text>().PressKeys("{Back}");[/b
]

I am using outlook 2010 and ranorex 7.2.0. This code was working before this work when attachments are displaying like a taskbar. but when display change for attachments this code get failed. Even different versions of outlook can create problems. So I want to know any efficient way or code for removing attachments from mail that doesn't matter with the position of attachments.

thanks

User avatar
Vega
Posts: 110
Joined: Mon Jul 11, 2016 2:15 pm

Re: How to remove attachments in outlook

Post by Vega » Tue Nov 28, 2017 10:04 pm

Why don't you just record yourself removing the attachments and then look at the code Ranorex generated for those steps? This would be the easiest way in my opinion:

Record yourself removing attachments -> Right click the steps that were created during the recording -> chose view code OR convert to code from the right-click context menu. This way you let Ranorex do the hard work and you can just adjust the code as needed if at all.

Hope this helps!