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 :
Microsoft Dynamics CRM (Archived)

WebRequest.Create(Uri) method is failing to create instance of HttpWebRequest

(0) ShareShare
ReportReport
Posted on by 10

I am using the below code to integrate SharePoint online & Dynamics 365 Online for creating folder in SharePoint. When i tried this code on console application it's working fine. But same code is not working if i registered as a plugin in CRM. While debugging the code i am getting the error in the highlighted line.

Uri MsoSTSUri = new Uri(msoStsUrl);

HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(MsoSTSUri);

byte[] responseData = HttpHelper.SendHttpRequest(
MsoSTSUri,
"POST",
saml11RTBytes,
"application/soap+xml; charset=utf-8",
request,
null);

I Would appreciate any help fix this issue.

Thanks,

Kanagaraj Pandian.

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at
    RE: WebRequest.Create(Uri) method is failing to create instance of HttpWebRequest

    Hi ,

    What's the error you are getting then ?

    Also could you tell us if you are enabling Sharepoint Server to Server Integration ?

  • kangaraj s Profile Picture
    10 on at
    RE: WebRequest.Create(Uri) method is failing to create instance of HttpWebRequest

    Hi CLAB01,

    I already tried with this (HttpWebRequest) WebRequest.Create(uri), but no luck.

    Thanks,

    Kanagaraj Pandian.

  • Community Member Profile Picture
    on at
    RE: WebRequest.Create(Uri) method is failing to create instance of HttpWebRequest

    hi ,

    If it's SharePoint online and Dynamics 365 online , then i assume you have enabled Server to Server integration in Dynamics 365 .

    If so , you can use the SDK to create A SharePoint Folder  =  Creating Sharpoint Location Record in CRM , check the link below for code.

    msdn.microsoft.com/.../gg309548.aspx

    i don't think you need custom code .

    Also there's no  HttpWebRequest.Create  but there is  WebRequest.Create which you can cast to HttpWeb Request . => (HttpWebRequest) WebRequest.Create

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Aric Levin - MVP Profile Picture

Aric Levin - MVP 2 Moderator

#2
MA-04060624-0 Profile Picture

MA-04060624-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans