I have one sharepoint online 365 site. In that one public site will be there. In that there is sign-in option. Generally When ever user clicks on signin it will redirect to microsoft login page. But i dont want to redirect user to login page. If user clicks on sign-in option then one popup will open where user enter his credentials. Now i want to to validate these credentials against the microsoft account using javascript only. No server side code. How i can achieve using webservices or any thing?
to use javascript you need to send a post request to a webservice, the url should look like this:
to read up on javascript post event read up here: http://api.jquery.com/jQuery.post/ the syntax is:
so from the above we would do the following:
its pritty simple! you are calling the ajax post event, setting the url to goto, the type which is a post event, its data type which is xml that i will show you in a min, the so moving onto
so the url that your using:
goto that location(obviously change the mywebsitename:2355 to your website address) and you can see somthing on the lines of:
you have two webservices within authentication, for you it would be login, so click on login. Now you can see the soap xml that you will need to imitate:
so based from the above we would use the following for our string varible:
now we have our string we can wrap it all together like this:
you could wrap the xml and ajax soap call code within a document ready function to wait for the dom to be ready before it executes the code. there is no need to wrap the resultsFeedback function as its only called if the soap call is sucessfull! your username and password would obviously need to be changed to add in the input how ever you decied to do it, be it in html or c# EDIT ahh missed your tag! sharepoint online! with sharepoint oline 365 using the webservice or any objects require authentication first! now the error your getting is todo with the cookie not being set or is set wrongly! how javascript and online work you can get a better understanding here: http://msdn.microsoft.com/en-us/library/gg454741(v=office.14).aspx for a solution check this out: https://github.com/lstak/node-sharepoint the solution to logging in is in sharepoint.js file. using c# client object model is easir to understand and can be followed here: unfortunatly online 365 is a bit more tricky as there is more handshaking going on so more validation between the client and the server instead of a simple use of sharepoint webservice with any other sharepoint product. | |||||||||
|