Today, when I created an app in Windows Phone 8, I had the requirement to to make a call in Windows Phone.

Code of xaml.cs

  1. private void PhoneCall_Click(object sender, RoutedEventArgs e)
  2. {
  3. PhoneCallTask phoneCallTask = new PhoneCallTask();
  4. phoneCallTask.PhoneNumber = "9717098666";
  5. phoneCallTask.DisplayName = "Dhananjay";
  6. phoneCallTask.Show();
  7. }
Code of XAML
  1. <Button x:Name="PhoneCall" Content="Button" HorizontalAlignment="Left" Margin="247,464,0,0" VerticalAlignment="Top" Click="PhoneCall_Click"/>
But while running an application, I encountered an error.

The error was: “An unhandled exception of type 'System.UnauthorizedAccessException' occurred in System.Windows.ni.dll”.

11

After some time I solved the error. I simply checked this Windows Phone Project by enabling (checking) the option ID_CAP_PHONEDIALER in the WMAppManifest.xml file of the Windows Phone Project to enable the option.

12

After that, I again ran the application and made a call.

13

Then:

14

Summary

This article described how to make a call in Windows Phone 8.