When I use the SetText activity in the Outlook To field, An error has occurred “The specified cast is invalid”.
We used the IndicateElement of the SetText activity to select the To field. Actually selector is valid.
The selector is as follows.
It’s strange that a cast Exception occurs in the set text activity.
The error has been resolved, but I feel that there is an error in the IndicateElement.
It is inconvenient that the function cannot be used.
Firstly, there’s was a known issues that indicate elements works on the second time only. Can you confirm other parts you are able to detect at once? And I see the elements in selector got reduced, so that was simply by indicate element of you altered the selector?
The type cast error comes while we convert the one data variable to another incorrectly. i assume the Set Value was putting a value that is not as a correct string, check if that string has any special character?
Secondly, i wonder why are you using UI automation on Outlook? You can use the Get email ans send email activity from UiPath.Mail.Activities
Also you can use Copy to clipboard activity and then paste using hoktkey (ctrl +v), to avoid any language related issues
The matter can be reproduced in my environment. It seems you use UiAutomation Package 21.10.0-preview, right? As it’s preview version, it might be better to use stable version (UiAutomation Package 21.4.4), if you have trouble.
Or you can also use explicit AA mode (Click F4 to change AA mode as the following) It will probably work.
You will have a structured screen. You can use attach browser/window and then simply send sufficient HotKey to reach the desired TO field and then use ctrl + v to paste the address (you can load the address in clipboard using Set to clipboard)
Also can you please let us know ehy you are not using the Mail.Activities package? We have outlook, exchange already configured via API in there.
Regarding this
That issue is raised by us at enterprise level to technical support team and they confirmed it is common behavior on few applications.
As far aa best practices are concerned, never go for UI automation on Microsoft’s Desktop applications. Already UiPath covered a lot and if not then you can always create custom activity.
Regarding your case, I think you should go for Outlook activities
We created UiPath hands-on materials to educate beginners. In the UiAutomation chapter, to operate the Outlook screen. So far, we haven’t had any problems with the material, but this time I’m having trouble with such an error.
Yes, I know that MailAcitivty should be used for Outlook operations.
If the error depends on a version of UiPath, We will update the material not to use that version.