Start Teams call from WinForms application - c# - c#

I'm trying to start a Microsoft Teams call from my WinForms c# application.
I think this is possible by opening a link that then triggers the Teams app to open.
I've searched the internet and stack overflow but can't find any good working examples.
I've also tried the below code, but nothing opens.
ProcessStartInfo processStartInfo = new ProcessStartInfo("https://teams.microsoft.com/l/call/0/0?users=<username>");
Changed ProcessStart code to the below and it will now open the link, but I receive an error within the Teams app: 'There's a problem with the link'
Process.Start(new ProcessStartInfo("https://teams.microsoft.com/l/call/0/0?users=<user1>,<user2>") { UseShellExecute = true });
Thanks

You can use msteams: url scheme like this:
System.Diagnostics.Process.Start("msteams:l/call/0/0?users=user#example.com");
Then it opens Microsoft Teams and asks you if you want to make the call.
You can find the supported format and parameters of here:
Deep link to start an audio-video call with users
I just replaced the web URL with msteam: url scheme.

Probably the reason is your link is not correct.
Please look at this answer.
Start Teams call from c#
And also try this kind of link for voice call:
https://teams.microsoft.com/l/call/0/0?users=<user1>,<user2>
and try this kind for video call:
https://teams.microsoft.com/l/call/0/0?users=<user1>,<user2>&withVideo=true

Related

Unable to get Selenium with Edge to work in a basic C# console application

I am trying for the very first time to use Selenium. I would like to have a console application that opens a browser, goes to a website, and performs some actions.
To do this I looked up some tutorials. The first one I found is here:
https://learn.microsoft.com/en-us/microsoft-edge/webdriver-chromium/?tabs=c-sharp
I would like to automate Edge.
The first thing I did was get my Edge version, which incidentally decided to update when I went to the about page, something that will no doubt be a problem going forward.
I downloaded the file that corresponded to my version, although for some reason that version is x86 only while all the others are x64...
I then went to NuGet and searched for Selenium.WebDriver. Probably because I'm targeting 4.7.2 the latest version is 3.141 not version 4, but whatever. I install version 3.
I also add a nuget reference to Microsoft.Edge.SeleniumTools as instructed in the guide.
the guide then says use this code:
var options = new EdgeOptions();
options.UseChromium = true;
var driver = new EdgeDriver(options);
However I don't have a UseChromium property, so this does not work.
I removed it, and used the default constructor, however this also doesn't work because it can't find the driver.
So next I passed in the path to the folder the driver is in as a parameter.
This also did not work because it is looking for a file with a different name to the one in the edge driver zip download. It looks for microsoftwebdriver.exe while the zip file contains msedgedriver.exe. Perhaps this is the reason for the error? It actually has a link in the exception when it can't find it of where to download it, however the link is dead.
I renamed the file, and ran the code. A console window appeared with debug information, and the browser opened. Success!
Next I tried to go to a website, with this code:
driver.Url = "https://www.google.com";
However with this I got these errors in the console window:
Starting MSEdgeDriver 94.0.992.38
(55a0a486d5c4c1a7374dc28a7be702fee43b3b39) on port 1307 Only local
connections are allowed. Please see
https://chromedriver.chromium.org/security-considerations for
suggestions on keeping MSEdgeDriver safe. MSEdgeDriver was started
successfully.
DevTools listening on
ws://127.0.0.1:1310/devtools/browser/c4e7f6f6-46d3-447c-b26b-3ad231a6122f
[29296:584:1001/203949.853:ERROR:fallback_task_provider.cc(119)] Every
renderer should have at least one task provided by a primary task
provider. If a fallback task is shown, it is a bug. Please file a new
bug and tag it as a dependency of crbug.com/739782.
[29296:26032:1001/203954.115:ERROR:chrome_browser_main_extra_parts_metrics.cc(250)]
crbug.com/1216328: Checking default browser status started. Please
report if there is no report that this ends.
[29296:584:1001/203954.143:ERROR:profile_manager.cc(1057)] Cannot
create profile at path
C:\Users\NibblyPig\AppData\Local\Microsoft\Edge\User Data\Default
[29296:584:1001/203954.143:ERROR:profile_manager.cc(2010)] Cannot
create profile at path
C:\Users\NibblyPig\AppData\Local\Microsoft\Edge\User Data\Default
[29296:26032:1001/203954.176:ERROR:chrome_browser_main_extra_parts_metrics.cc(254)]
crbug.com/1216328: Checking default browser status ended.
The code then crashes with OpenQA.Selenium.WebDriverException: 'unknown error: net::ERR_CONNECTION_TIMED_OUT
I've tried googling the fallback task provider error and also looking at the profile error, but there is very little information and I am at a loss of what to do.
I wonder if anyone could advise what steps I might take to get this working.
First, if you use WebDriver with Selenium 3, the Selenium Tools for Microsoft Edge package must be installed.
Did you import the wrong package? Make sure it is using Microsoft.Edge.SeleniumTools; not using OpenQA.Selenium.Edge;.
This is my simple test, and it works well:
public static void Main() {
var options = new EdgeOptions();
options.UseChromium = true;
options.BinaryLocation = #"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe";
var driverPath = #"C:\Users\Administrator\Desktop";
var driver = new EdgeDriver(driverPath, options);
driver.Url = "https://www.google.com/";
}
Note: Please modify the path parameters according to your own situation.

Open c# Application from another Application

I have a problem, I already have webbrowser in c# app, I want to send url from another app, and open my c# app and url what I sent from another application.
Any ideas, tutorials, anything. Thanks
So based on what I understand from your question, you want to pass URL by app1 and open app2 with that url in app2(webbrowser control).
You can use Commandline Arguments to pass data between process,
Refer this stack overflow link command line arguments to winform applications
You could use Process.Start to start the process:
System.Diagnostics.Process.Start("path/to/browser.exe", "https://sampleurl.org");
And in your application, depending if it is wpf, winforms or something else read the arg (there are plenty of questions how to do it on stackoverflow)
You could use Process.Start to start the process:
Process.Start("path/to/browser.exe", "https://sampleurl.org");
And in your c# program access it in the main

Send a string to IE and IE execute the string but not have IE appears or the Console screen appear

I don't know if it is possible to do this in Windows Console Application (C#) but I really need something like this for my project.
I would like to send a string (or URL link) to the IE and have IE execute that string. However, since this string is static; what it does is just turn a machine ON and OFF via internet. So, in this case I have no interest in seeing the IE to popup/display nor the black screen console to appears when the application got executed.
I know in Console Application C# we can do something like this
Process.Start("iexplore.exe", #"http://myserver.com");
However, when I run the above line, the IE popup and so does the black screen console.
Is there a way to not have IE popup and the screen console to not popup, too?
Thanks.
I think you are going about this the wrong way. IE is merely a portal to web requests. Just make the web request call directly. using something like the new Web API or HttpWebRequest
As to making the console not pop up, maybe you should be creating a Windows Service instead of a console application? We would need more details on the end user. If this is more of an automated action, then a service would work. If it is something the user clicks on, then why is displaying the console a bad thing? Typically, when you click on something you expect some sort of visual representation. But, here is a SO that answers this question already
Try ProcessStartInfo. This will hide the console app, but I'm not positive about it hiding IE.
ProcessStartInfo psi = new ProcessStartInfo("iexplore.exe", #"http://myserver.com");
psi.WindowStyle = ProcessWindowStyle.Hidden;
Process.Start(psi);

c# interactiveProcessRunner

Can someone tell me what the InteractiveProcessRunner is for? Is it identical to Process.Start?
Here is the class.
And here an example :
InteractiveProcessRunner runner =
new InteractiveProcessRunner(notepad.exe,hSessionToken);
THX
Whit this class you can run a process with the complete environment of the user active: if you call this code from a service, you should find the user mapped resources, the desktop and all the resources that are available when the user is loggen on interactively even if launched from a service ie not logged interactively.
The source code to which your link leads referes to this article: http://asprosys.blogspot.com/2009/03/perils-and-pitfalls-of-launching.html which explains the motivation behind it.
Summary: You can't really use Process.Start() when you want to start a new process as certain user from a windows service. The InteractiveProcessRunner lets you do this (supposedly, never used it so I can't verify it). So it's not the same as Process.Start() - it uses a different Windows API.

how to program to integrate with filezilla in C#.[sftp]

I would like to integrate FileZilla with my application written in C#.
please someone show me sample code or web site that shows sample code.
although i found article on web, and that article was saying
"application is integrated with FileZilla is so slow".
but i don't know if i can stand that late or not.
so i would like to challenge.
To support FTP/SFTP or any other protocol in C# you can do it in 3 ways:
1. NEW APP PROCESS - Start an app that does the FTP communication in separate process, and be able to control what file to download, where to save it and to tell the app to terminate when download is finished. This way, you can use FileZilla only if it lets you pass certain parameters in command line, like the URI of the resource you want to transfer through FTP/SFTP, and the path where the file should be saved to. And as I can see HERE this could work.
To start the process and pass it command line arguments in C# you would do something like this:
static void StartNewProcess(string app, string args)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = app; //full app path
startInfo.Arguments = args; //command line arguments
startInfo.CreateNoWindow = true; //dont create app window
startInfo.WindowStyle = ProcessWindowStyle.Hidden; //hide app from taskbar
Process.Start(startInfo);
}
Now you can execute FileZila app, pass it args containing file URL and let it do its job... But you cant know how long will it take to download the file, when the download is ended, do you need to log in to get it...
2. EXISTING CLASS LIBRARY - Include a Class Library that is written by someone else, that does the job. This way you are in TOTAL control of the process. And as many other suggested, this would be a perfect way for you. Many answers here contain good class libraries that you can use and be happy with the results.
3. HOME-MADE CLASS LIBRARY - Open RFC 959, read it all and write your code... (Now 2. sounds better, doesn't it? :D)
Filezilla is a GUI FTP client, you can't use it to "script" SFTP operations (it only accepts a very limited set of command line arguments).
You must seek a third party C# component or write one yourself (not recommended) to do the job.
To support FTP or SFTP from your C# application, you could use an external library like the one from Chilkat http://www.chilkatsoft.com/ftp-2-dotnet.asp. I use it and it works great!
In theory, you could also implement the FTP protocoll using socket connections by yourself, but you should save yourself that trouble -> don't reinvent the wheel...
I recommend using SharpSSH, if you need to send files via SSH/SFTP in your application.

Categories

Resources