Using owssvr.dll to retrieve List data in XML format

Owssvr.dll is a traditional Remote Procedure Call method to remotely invoke functions in SharePoint. It can be used to retrieve data from SharePoint list as well.

syntax:
https://sharepoint.com/_vti_bin/owssvr.dll?Cmd=Display&List=<<LIST-GUID>>&XMLDATA=TRUE

E.g.
https://intranet.sharepoint.com/_vti_bin/owssvr.dll?Cmd=Display&List={6685db48-013f-4934-8147-b7a6014eccc9}&XMLDATA=TRUE

Other options:
Filter &  View
Append –  FilterField1=<<Field-Internal-Name>>&FilterValue1=<<Value-of-the-field>>
e.g:
FilterField1=Domain&FilterValue1=Sales
View={ViewGuid}

How to get the List GUID?
Go to List settings >> right click “Audience targeting settings” Say “Copy Shortcut”. Now you will get something like: https://sharepoint.com/sites/Test/_layouts/ListEnableTargeting.aspx?List={6685db48-013f-4934-8147-b7a6014eccc9}
Highlighted is the GUID.

Output:

Using owssvr.dll to retrieve List data in XML format

Once you get the XML you can use it wherever required.
E.g.:

<script type="text/javascript">
function GetListData()
{
// Get the data from SharePoint List
var reqstring ="https://SharePoint.com/_vti_bin/owssvr.dll?Cmd=Display&List={6685db48-013f-4934-8147-b7a6014eccc9}&XMLDATA=TRUE";
var req = new ActiveXObject("MSXML2.XMLHTTP");
req.open("GET",reqstring,false);
req.send();

//Load response in XML Document
var doc = new ActiveXObject("MSXML2.DOMDocument");
doc.loadXML(req.responseText);
 //Traverse inside doc to retrieve values
 alert(data);
}
</script>

SharePoint Online: Get List data in XML format using Owssvr.dll

You can also PowerShell to retrieve List data in XML format from OWSSvr.dll

Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking

#Parameters
$SiteURL = "https://crescent.sharepoint.com/sites/marketing"
$ListName = "Contacts"
$ViewName = "All Items"

#Get Credentials to connect
$Cred= Get-Credential

Try {
    #Setup the context
    $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
    $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)

    #Get Necessary Objects
    $Web = $Ctx.Web
    $List = $Web.Lists.GetByTitle($ListName)
    $View = $List.Views.getByTitle($ViewName)
    $Ctx.Load($Web)
    $Ctx.Load($List)
    $Ctx.Load($View)
    $Ctx.ExecuteQuery()

    #Request XML data throgh RPC
    $URL = "{0}/_vti_bin/owssvr.dll?Cmd=Display&List={1}&View={2}&Query=*&XMLDATA=TRUE" -f $Web.Url, $List.ID, $view.ID
    $WebClient = New-Object System.Net.WebClient 
    $WebClient.Credentials =  New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
    $WebClient.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f")
    $XML = $WebClient.DownloadString($URL)
    $WebClient.Dispose()
}
Catch {
    write-host -f Red "Error:" $_.Exception.Message
}

More Examples:
https://msdn.microsoft.com/en-us/library/ms478653.aspx
https://msdn.microsoft.com/en-us/library/ms416599.aspx
https://blogs.msdn.com/b/infopath/archive/2007/01/15/populating-form-data-from-sharepoint-list-views.aspx
https://sharepointfordeveloper.blogspot.com/2012/03/sharepoint-rpc-protocols-examples-using.html

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. Passionate about sharing the deep technical knowledge and experience to help others, through the real-world articles!

6 thoughts on “Using owssvr.dll to retrieve List data in XML format

  • https://servername:port/_vti_bin/owssvr.dll?Cmd=Display&List={GUID}&XMLDATA=TRUE

    as I use this link in my browser it prompts for credentials. I dont know what credentials it is asking for.

    Some one please guide me about the credentials to be used because even if I enter the credentials, i.e. of my system or the site’s credentials, I dont see any XML file to be generated. Is it because my site is form base authenticated?. please suggest how can I used owssvr.dll

    Reply
  • What do we do if the list view threshold for a SharePoint Online list is reached. We do not have the ability to increase the list view threshold. Even though the view we are accessing through the code has very less items, but we still get an error while executing this code. Your inputs will be very helpful.

    Reply
  • This code doesnt work if the list view threshold of 5000 is reached. In SharePoint Online we do not have the option to increase the list view threshold. Is there any way we can make this code work?

    Reply
  • oh! Good man! Thanks a lot

    Reply
  • oh! Good man! Thanks a lot

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *