1

Good day!

I have a peculiar problem. I have a SharePoint 2016 on premise setup. I am executing a post call renderlistasstream. The aim here is to get documents in increments of a 1,000.

The rest call is as follows...

http://sharepoint.com/sitename/_api/web/lists/getbyid('b2c42a8f-55a1-421a-93b0-36c8a8c93a60')/RenderListDataAsStream

The post call works. However, I need the attribute found in NextHref to call the next 1,000 documents. The problem here is the GUID for the view comes back as all zeros (see the screenshot). This results in a bad call if I try to use it in the next call. Anyone knows why this is returning all zeros?

enter image description here

UPDATE: October 21 2019

This is the header information I include on the call.

{'parameters': {'__metadata': { 'type': 'SP.RenderListDataParameters' }, 'ViewXml': '<View Scope="RecursiveAll"><Query><Where><Eq><FieldRef Name="FSObjType" /><Value Type="Integer">0</Value></Eq></Where></Query><RowLimit Paged="TRUE">1000</RowLimit><ViewFields><FieldRef Name="FSObjType" /><FieldRef Name="LinkFilename" /><FieldRef Name="Modified" /><FieldRef Name="BaseName" /><FieldRef Name="FileSizeDisplay" /><FieldRef Name="Created" /><FieldRef Name="FileLeafRef.Suffix" /><FieldRef Name="FileRef" /></ViewFields></View>', 'RenderOptions': 2}}

UPDATE: October 23 2019

So just some added context. This is releated to a power BI issue we have that I am attempting to debug. I have a ticket with Microsoft and am working with them to try to resolve this. Basically, using Power BI Desktop (September 2019), we are using the SharePoint Folder connector to access files stored on SharePoint. I can see from Fiddler that Power BI is triggering SharePoint REST calls to access data in increments of a thousand. The first rest call works. The second one fails. it fails because the VIEW parameter is a bunch of 0's as detailed in my post above.

The rest call i placed above along with the header is what Microsoft's own product (Power BI Desktop) is generating. The NextHref parameter comes back with a query string with a VIEW guid full of zeros. I don't want to believe that a major Microsoft product would have such a flaw, so my assumption is that our instance of SharePoint using the RenderListDataAsSteam operation is preventing the View Guid from showing.

I've included some code whereby you can test the call (I lowered the call from 1,000 documents to 10). Would it be possible for someone to test it to see if they get the view guid in the nexthref paramater? If so, than that suggests its an issue with our setup of SharePoint. You just need to have JQuery on the page to execute this call.

var contentBody = {'parameters': {'__metadata': { 'type': 'SP.RenderListDataParameters' }, 'ViewXml': '<View Scope="RecursiveAll"><Query><Where><Eq><FieldRef Name="FSObjType" /><Value Type="Integer">0</Value></Eq></Where></Query><RowLimit Paged="TRUE">10</RowLimit><ViewFields><FieldRef Name="FSObjType" /><FieldRef Name="LinkFilename" /><FieldRef Name="Modified" /><FieldRef Name="BaseName" /><FieldRef Name="FileSizeDisplay" /><FieldRef Name="Created" /><FieldRef Name="FileLeafRef.Suffix" /><FieldRef Name="FileRef" /></ViewFields></View>', 'RenderOptions': 2}};


var contentURL = "http://sharepoint.com/sites/KyleTest1/_api/web/lists/getbyid('33577BEB-BC5D-4BE5-817C-7D235EF942DD')/RenderListDataAsStream"


$.ajax({
 async: true,
 method: 'POST',
 url: contentURL,
 headers: {
                        "ACCEPT": "application/json;odata=verbose",
                        "content-type": "application/json;odata=verbose",
                        "X-RequestDigest": $("#__REQUESTDIGEST").val()

        },
data: JSON.stringify(contentBody),
        success: function (data) {

                alert("Success!");
                console.log(data);
        },
        error: function (error) {
                        alert("Failed");
                        alert(JSON.stringify(error));
        }
 });
3
  • How come you pass a viewxml? Are you dependent upon certain fields? Oct 24, 2019 at 7:34
  • So technically its not me creating this REST call. Its PowerBI using its SharePoint folder connector feature. I was able to pull the REST call and the body using Fiddler. It creates the view xml to get specific file types and to search through all the folders of a SharePoint site. It also sets a row limit of 1,000. This is so that rather than one MASSIVE REST call, it does several REST calls in increments of a 1,000. Oct 24, 2019 at 14:00
  • I see, i tried to replicate it for a test but without success. I will try to give it a shot later. Oct 25, 2019 at 7:59

2 Answers 2

1
+100

Try specifying the default view of the list in the url of the call.

enter image description here

This will end up putting a valid id in the NextHref link.

enter image description here

I dont think it will really matter which view id you put there as long as its a valid id. To find the view id go into list settings and click on the default view and you will find the id in the url.

enter image description here

Update from Kyle:

So basically, I determined with Microsoft that this rest operation behaves slightly differently between SharePoint 2016 vs. SharePoint 2019 / Online. 2016 requires you to specify the view parameter at the start (as pointed out by Johan) but the others include the view parameter regardless if you include it in the initial call.

Thank you for your help!

2
  • 1
    Im sorry i missed the part where you wanted the explanation why it is missing. But the short answer would be that you override the view by putting a viewxml in the request body. And therefore the sharepoint api cant figure out which view to send you to and sets a empty Guid because its needed Oct 23, 2019 at 15:17
  • Hi Johan! I marked your answer as useful its the closest thus far to what I am looking for. I added some context to to my original post just to explain what I am try to get. Oct 23, 2019 at 17:00
0

Are you querying any specific view? or just the OOB Library with no specific view?

For the similar issue I see there are couple of workarounds community is talking regarding similar issue when you use the RowLimit and PageFirstRow as parameters.

Please take a look at it here and see if that is related to your issue. https://github.com/pnp/pnpjs/issues/532

-Praveen.

1
  • So the initial call makes no request for any specific view. That said, everything that I am seeing online, a view parameter should be supplied back for the next href. I will put the header that I use to show what I am querying. See update to the original post. I did check that github issue you posted but it does not quite match. Oct 21, 2019 at 19: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.