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)

sharepoint integration

(0) ShareShare
ReportReport
Posted on by

Hi Dears,

I am using javascript for create the site in the sharepoint from crm. i testing through this one html web resource. I got the below error when debugging:

Uncaught ReferenceError: NetworkCredential is not defined

clientContext.Credentials = new NetworkCredential('Sharepoin*******', 'Pickle*****');

 


The below is full code. please give the solution for this urgently..

<html><head>


<script type="text/javascript" src="ajax.aspnetcdn.com/.../jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="sharepoint.parkbridge.com/.../MicrosoftAjax.js"></script>
<script type="text/javascript" src="sharepoint.parkbridge.com/.../sp.runtime.js"></script>
<script type="text/javascript" src="sharepoint.parkbridge.com/.../sp.js"></script>
<script type="text/javascript" src="ajax.aspnetcdn.com/.../jquery-ui.min.js"></script>
<script type="text/javascript" src="ajax.aspnetcdn.com/.../knockout-2.1.0.js"></script>
<script type="text/javascript">
function createWebsite() {
debugger;

// var clientContext = new SP.ClientContext('myserver/.../MyWebSite');
var clientContext = new SP.ClientContext('sharepoint.parkbridge.com/crm-listings');

//clientContext.DefaultNetworkCredentials;
clientContext.Credentials = new NetworkCredential('Sharepoi*******', 'Pickle*******');

var collWeb = clientContext.get_web().get_webs();
console.log(collWeb);


var webCreationInfo = new SP.WebCreationInformation();
webCreationInfo.set_title('My New Web Site');
webCreationInfo.set_description('Description of new Web site...');
webCreationInfo.set_language(1033);
webCreationInfo.set_url('MyNewWebSite');
webCreationInfo.set_useSamePermissionsAsParentSite(true);
webCreationInfo.set_webTemplate('STS#0');

var oNewWebsite = collWeb.add(webCreationInfo);


clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}

function onQuerySucceeded() {
debugger;
alert("Created Web site.");
}

function onQueryFailed(sender, args) {
debugger;
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}</script>

<meta><meta><meta><meta><meta><meta><meta><meta></head>
<body style="word-wrap: break-word;" onload="createWebsite();"><meta><meta></body></html>

 

*This post is locked for comments

I have the same question (0)
  • jbinaz Profile Picture
    20 on at

    It looks to me like you're trying to use the .NET NetworkCredential class in JavaScript code. .NET is server side and JavaScript is client side.

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