viewpoint-spws icon indicating copy to clipboard operation
viewpoint-spws copied to clipboard

Get_list_items method in websvc not available to SPWSClient (and query passing doesnt seem to work)

Open ChrisPr1 opened this issue 8 years ago • 1 comments

ruby 2.2.5p319 viewpoint-spws 0.5.5

I'm a relative ruby novice.

I would like to take advantage of the get_list_items method call in the SPWS::Websvc module, but its marked as a private method. To this end I added the following lines of code to my installed viewpoint-spws GEM spws_client.rb file:

< def get_list_items(list, opts = {})
lists_ws.get_list_items(list, opts = {})
end
>

Doing this allows me to call get_list_items from within a SPWSClient connection. Is there a reason why this isnt included in the release viewpoint-spws-0.5.0 ?

The main problem I have is when trying to pass a builder query to get_list_items as shown in the example code at rubydoc

< myitems = scli.get_list_items('Some Valid Sharepoint Page') do |b| b.Query { b.Where { b.Eq { b.FieldRef(:Name => 'Release') b.Value('foo', :Type => Text) } } } end />

When i look at a tcpdump output of the XML being submitted to sharepoint, I'm not seeing the CAML query being submitted as part of the get_list_items:

<

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header/>
  <soap:Body>
    <GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
      <listName>Some Valid Sharepoint Page</listName>
      <viewName/>
      <rowLimit/>
      <queryOptions>
        <QueryOptions>
          <Folder/>
          <ViewAttributes Scope="Recursive"/>
          <DateInUtc>True</DateInUtc>
          <IncludeAttachmentUrls>True</IncludeAttachmentUrls>
        </QueryOptions>
      </queryOptions>
    </GetListItems>
  </soap:Body>
</soap:Envelope>`

/>

Any thoughts on what might be going wrong?

Cheers

ChrisPr1 avatar Nov 23 '16 16:11 ChrisPr1

I've resolved the not being able to see the opts{} hash being passed by changing the spws/lists.rb edit to be:

< def get_list_items(list, opts = {}) lists_ws.get_list_items(list, opts) end />

Options passed are seen now. However my 'new' problem is that I dont know how to properly pass the yield block into the private method call to lists_ws.get_list_items(list, opts) in the above code block.

ideas?

ChrisPr1 avatar Nov 23 '16 21:11 ChrisPr1