web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

SendEmail Web API ERRORS: "No HTTP resource was found that matches the request URI" and "')' or ',' expected at position..."

(0) ShareShare
ReportReport
Posted on by 283

I'm trying to create an Email record and then send it using JS. Here is a portion of my code:

    Xrm.WebApi.createRecord("email", data).then(

        function success(result) {
            var emailId = result.id;
            emailId = emailId.substring(1,emailId.length-1);

            window.parentFormContext.getAttribute("new_giresponseemail").setValue("/emails("   emailId   ")");

            var url = 'https://ORGNAME.crm.dynamics.com/api/data/v9.1/emails('   emailId   ')/Microsoft.Dynamics.CRM.SendEmail';

            var body = JSON.stringify({
                "IssueSend": "true"
            });

            var req = new XMLHttpRequest();
            req.open("POST", url, true);
            req.setRequestHeader('Content-Type', 'application/json');
            req.send(body);

            Xrm.Utility.showProgressIndicator("Please wait a moment...");
            
            req.onreadystatechange = function () {
                Xrm.Utility.closeProgressIndicator();    
                
                if (this.readyState === 4) { 
                    
                    req.onreadystatechange = null;
                
                    if (this.status === 200) {
                        var result = "Response successfully sent!"; 
                        alert(result); 
                    }
                    else if(this.status === 400){
                        var result = "ERROR: Please contact your CRM administrator."; 
                        alert(result);
                    }
                }
            }  
        },

        function (error) {
            console.log(error.message);
        }
    )

This creates the email record correctly. However, when the XMLHTTPRequest is opened I'm getting a 400 response with the error message "')' or ',' expected at position 4 in (GUID)" for the API action. Sometimes the "position" number is different depending on the GUID that was generated for the new email record.

If I enter the API URL in the browser manually I get this error: "No HTTP resource was found that matches the request URI '">ORGNAME.crm.dynamics.com/.../Microsoft.Dynamics.CRM.SendEmail'."

I've scoured the internet trying to find a solution for this but no luck. Thanks for any help!

I have the same question (0)
  • Lucas H Profile Picture
    283 on at
    RE: SendEmail Web API ERRORS: "No HTTP resource was found that matches the request URI" and "')' or ',' expected at position..."

    Thank you SO MUCH! This worked perfectly. Glad the fix was so simple but wish I'd asked before spending a couple hours frantically Googling...

  • Suggested answer
    Charan Raju C R Profile Picture
    7 Moderator on at
    RE: SendEmail Web API ERRORS: "No HTTP resource was found that matches the request URI" and "')' or ',' expected at position..."

    Hi Lucas,

    Take out or comment line #5: emailId = emailId.substring(1,emailId.length-1); 

    Id of the result (email) is not enclosed within '{' and '}'. So, this line is not required as trimming is not necessary. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daniyal Khaleel Profile Picture

Daniyal Khaleel 122

#2
DAnny3211 Profile Picture

DAnny3211 101

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 70 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans