Developer
Developer

Reputation: 4321

PhoneCallTask fails

This is a really simple task but somehow it fails...

private void TextBlock_Tap_1(object sender, System.Windows.Input.GestureEventArgs e)
    {
        if (WasSwipe != true)
        {
            //JUST TO CHECK THAT CODE GETS HERE - RUNS PERFECT
            MessageBox.Show("");

            //FUNCTION
            var phoneCallTask = new PhoneCallTask
            {
                DisplayName = "Kunal Chowdhury",
                PhoneNumber = "0208795446322"
            };
            phoneCallTask.Show();
            //FAILS HERE, AFTER SHOW
        }
        else
        {
            WasSwipe = false;
        }
    }

When i want to show task it fails with this:

Message: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Source: Microsoft.Phone

Stack-trace: at Microsoft.Phone.Tasks.PhoneCallTask.NativeMethods.PhoneInitiateOutgoingPhoneCall_External(String pDialString, String pDisplayName)

at Microsoft.Phone.Tasks.PhoneCallTask.PhoneDial(Object phoneCallTask)

at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)

at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()

at System.Threading.ThreadPoolWorkQueue.Dispatch()

at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

IN ADDITION:

Email task works:

 EmailComposeTask emailComposeTask = new EmailComposeTask();

            emailComposeTask.Subject = "message subject";
            emailComposeTask.Body = "message body";
            emailComposeTask.To = "[email protected]";
            emailComposeTask.Cc = "[email protected]";
            emailComposeTask.Bcc = "[email protected]";

            emailComposeTask.Show();

Upvotes: 0

Views: 338

Answers (1)

MarcinJuraszek
MarcinJuraszek

Reputation: 125620

You probably didn't specify following permission in your app manifest file:

ID_CAP_PHONEDIALER

Upvotes: 6

Related Questions