Sdílet prostřednictvím


Automatic refresh in SharePoint Document Libraries

It was very interesting to find out that the list of documents refreshes only once automaticaly in the browser window. The issue is if you open for editing an Office document it should appear as checked out for editing. Now if you edit the document and durring this time you will change the focus on the browser window where you have the list of files, then at the momet you save the file and check it in from Office application, if you will look in the browser you will see that the file is still checked out. If you will do a refresh the file will be diplayed correctly.

This is the way I tried to explain this behavivor:

The data from any server (and a SharePoint server too) is sent to the client only when the client is asking for it and only then. In our case the clients would be the browser (Internet Explorer) and the Office application (let's say Microsoft Office Word).

If the client is not asking to refresh the page the question would be then – and why sometimes it happens to the page to be refreshed? It is because the SharePoint page contains a javascript code that perform a request to the server, and now we should see when this request is made and what do we do to start it.

The request to refresh the page is made first time we are focusing on the browser window again after opening a document in Office.

To test it you can follow the following steps:

1. Open a SharePoint document library in the browser

2. Open an Office file by just clicking on it

3. Switch back the focus to the browser and you will see that the page is refreshing

So if a user want to be sure that he will be able to see the document status correct without pressing F5 (refresh) he should consider the following – don't switch the focus to the browser window until the moment you made the modification you want to see it on the page.

Now we know that the server cannot force the client (browser) to refresh the page even if he received from another client application (Word) the confirmation that the file status was modified. And the "automatic refresh" of the page is actually not made by the server, it is made by a javascript code running on the client side.

We could say that that javascript which makes the first request for refresh can do it:

- On every focus on the browser window

- Every 1 minute (or another amount of time)

These ideas are not acceptable because they will generate an extra loading of the network bandwidth.

For the first idea let's imagine that we have a user that switches the window with Alt+Tab and he gets all the time on our browser window, or you can imagine other situations where a lot of users are just getting back to the page and the server receives requests over and over to respond with the a fresh rendered page.

For the second idea we have the same considerations – one hundred users just keeping the page open will generate one hundred requests every minute (or period of time that could be established).

The only possibility to change this behavior would be to change the javascript code used by the page, however this approach will make the product not supported.