2

My question is Can someone tell me the possible ways, I can get data from a sharepoint 2007 list, which is secured with SSL/Https for a Windows 7 gadget(uses HTML/Java Script),

(I asked my senior developers and they told me that a client first fills in a form, which is validated by ISA server and gives client a cookie, which he uses later on access the sharepoint sites he got access to, which makes me assume that its a forms authentication but then am not sure if its windows authentication as users fill in a form @ IE but if I open up same portal in chrome, a windows pops up and ask for username and password)

I have been looking at different ways, but am not sure which one exactly gonna work on in this scenario.

EDIT:
After research on Windows/Forms Authentication, I came to know we are using windows authentication.

So my question will be changed to something like this,

What are the possible ways to get a SPlist data using SOAP/Webservices, using "_vti_bin/authentication.asmx" and then "_vti_bin/lists.asmx" "GetListItems()". Keeping in mind that I dont wanna use .Net(web reference) as I am developing it for a Windows Vista Gadget which will be built using HTML/Scripting language

Cheers

More Explanation:

I tried given answer code spinets but I didn't got any success, I also came to know that a client is using basic Authentication and then Kerbos authentication somewhere between servers, Now I tried this code, which isn't working either,

    <html>
<head>
<title>Sharepoint List Browser</title>
</head>
<body style="width:400px; height:400px;">
<div id = "abc">
<button id = "btnFindLists" type="button">Click Me!</button>
<div id="mainContent">
   <p>1</p>  <!--  -- that p will be returned -->
  <p>2</p>
</div>

<script type="text/javascript" language="javascript">
  $('document').ready(function () {
    $('#btnFindLists').bind('click', findLists);
  });
  function findLists()
  {
    $.ajax(
    {
        type:'GET',
        url:'https://usa2020.domainabc.com/portal/_vti_bin/Lists.asmx',
        data:"username=domainabc\userabc&password=apassword",
        success: function(data){
        alert('successful');
      }
    });
  }
</script>
</body>
</html>

"alert" function doesn't work in a Gadget.

I tried Falak's Code as this

    <html>
<head>
<title>Sharepoint List Browser</title>
<script type="text/javascript" language="javascript">
  $('document').ready(function () {
    $('#btnFindLists').bind('click', findLists);
  });
  function findLists()
  {
    $.getJSON("https://usa2020.domainabc.com/portal/_vti_bin/Lists.asmx", {
      sucess: function (data, textStatus, xhr) {
        $("#mainContent p").first().html(data);
      }
    });
  }
</script>
</head>
<body style="width:400px; height:400px;">
<div id = "abc">
<button id = "btnFindLists" type="button">Click Me!</button>
<div id="mainContent">
   <p>1</p>  <!--  -- that p will be returned -->
</div>
</body>
</html>

Simply doesn't work like others, possible reason could be windows authentication.

Cheers

EDIT 2: *Another thing I would like to add now, which is I can't get to Webservices until I logon to ISA server, thats another clue i got.*

3
  • 2
    I'm not sure I understand what you're asking, considering you've already given the answer yourself. In other words, you say you want to use web services, even the specific web services you will use, and then you ask what you should use? Commented May 20, 2012 at 12:59
  • Hi Bjorn Problem is I dont know how to do this tho, I couldn't find any related code snippets tbh. Commented May 21, 2012 at 6:45
  • I couldn't find specific answer to my question but i gonna accept the closet one, but if you still come here and know the answer please do contact me as I dumbed this project for the moment Commented May 25, 2012 at 10:28

1 Answer 1

2

I am thinking why wouldn't you use ListData.svc instead of Lists.asmx to get the list data. ListData.svc provides a way of getting information from a list (or lists using joins) using REST and you end up with is a nice RSS feed of list data, that you can consume with whatever client you would like.

Also, you don't have to create the Web reference as you mentioned in the question and still make your job done via client side scripting. Here is sample query to ListData.svc using jQuery

<script type="text/javascript" language="javascript">
  $('document').ready(function () {
    $('#btnFindLists').bind('click', findLists);
  });
  function findLists()
  {
    alert('Hello World!');
    $.getJSON("/_vti_bin/ListData.svc", {
      sucess: function (data, textStatus, xhr) {
        $("#mainContent p").first().html(data);
      }
    });
  }
</script>
13
  • Hi Falak, so if i use this code snippet, do i have to make any changes to server side and whether it will work with Sharepoiint 2007 or not. Cheers Commented May 21, 2012 at 6:48
  • and how windows authentication will gonna work in this case Commented May 21, 2012 at 6:59
  • one more thing, In gadgets "alert" function doesn;t work Commented May 21, 2012 at 7:26
  • when you querying ListData.svc and if your SharePoint web application is configured using Windows Authentication with either NTLM or kerberos, your browser will either transmit your credentials automatically. To handle that,you can redirect the user to the regular SharePoint login page. here is a link,you can refer to it. silver-it.com/node/73 Commented May 21, 2012 at 7:42
  • You can only use ListData.svc in SharePoint 2010 and for 2007 you have to use Lists.asmx. For using the above mentioned script you don't have to make any server side changes. Commented May 21, 2012 at 7:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.