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

Notifications

Announcements

No record found.

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

    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

  • kangaraj s Profile Picture
    10 on at

    Hi CLAB01,

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

    Thanks,

    Kanagaraj Pandian.

  • Community Member Profile Picture
    on at

    Hi ,

    What's the error you are getting then ?

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

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans