SharePoint RPC Protocols Examples Using OWSSVR.DLL


What is SharePoint RPC Protocols?

Part 1

This reference includes information about the methods and usage of SharePoint Foundation Remote Procedure Call (RPC) protocol. This protocol can be used in Win32-based applications or in ASPX applications to make HTTP POST requests to the server. Methods in this protocol that do not modify the contents of the database can also be used in URL protocol to make HTTP GET requests.
You will find the OWSSVR.DLL in SharePoint 2010 Server Physical Path: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI and MOSS C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI

OWSSVR.DLL List of commands
  • DialogView 
  • Display
  • ExportList
  • GetProjSchema
  • GetUsageBlob
  • HitCounter
  • RenderView
To read more about the OWSSVR.DLL command Please read the URL Protocol from Microsoft Blog having a URL http://msdn.microsoft.com/en-us/library/ms478653.aspx.

Using OWSSVR.DLL we can do the following things
  • Export SharePoint List to Excel.
  • Exports the schema of the list.
  • Exports this SharePoint List as a CAML file(.XML)
  • Opens a view of the document libraries within a site.
  • SharePoint Calendar Items Export to Outlook
  • SharePoint Contact List items Export to Outlook
  • Export SharePoint List to Excel
I will illustrate you how we can able to do the above things with example.
I am using the SharePoint Custom list let’s say customer having two columns.

Title (Customer Name)

City (lookup from City List)
You can create your own list it is just for the test I am using this list reference in this post.

Export to Excel steps as below (From Default view or specific view)
  • Copy the List URL (If you click the List Settings button by going to list tab you will see the list URL) copy the List URL. Example http://<SiteName>/_layouts/listedit.aspx?List=<GUID>
  • Copy the List View URL(if you click the modify view button from the list tab you will see the VIEW url) Copy the View URL. Example http://<SiteName>/_layouts/ViewEdit.aspx?List=<GUID>&View=<GUID>
  • Use this command and replace the place holder you’re your site name , list GUID and view GUID. So command http://<SiteName>/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List=<GUID>&View=<GUID>&CacheControl=1
SO I replaced the place holder with my SharePoint Site it look like below.

Generate the Excel with default view no need to pass the view in query parameters.
http://home/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List={5C8C1317-1C3F-4464-8A4F-1F363C84E2F0}&CacheControl=1

Generate the list with a specific view

http://home/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List={5C8C1317-1C3F-4464-8A4F-1F363C84E2F0}&View={C738501D-EC82-454F-A9DC-42CA937722FE}&CacheControl=1

I paste this URL to my browser and I will get the following file download message.


Excel Out Put


Please Make a Note :
Export SharePoint list to excel we are using query.iqy, or query.bqy in Using Parameter

Export Single SharePoint Calendar List items to Outlook we are using event.ics in Using Parameter   
Export SharePoint Calendar List to Outlook. Replace the Place holder with your configuration example. Site URL is the name of the SharePoint Site calendar list GUID and Item id.

http://<SiteURL>/_vti_bin/owssvr.dll?CS=109&Cmd=Display&List=<GUID>&CacheControl=1&ID=<ITEMID>&Using=event.ics

When I copied the above both calender list item in browser URL I will get the following download contact item.


Export Single SharePoint Contact List items to Outlook we are using vcard.vcf in Using Parameter
  

http://<SiteURL>/_vti_bin/owssvr.dll?CS=109&Cmd=Display&List=<GUID>&CacheControl=1&ID=<ITEMID>&Using= vcard.vcf 

 When I copied the above both Contact list item in browser URL I will get the following download contact item.


Exports this SharePoint List as a CAML file(.XML) 

Use the Display command having XMLDATA=TRUE Parameter to export the data to xml

http://<Server_Name>/<sites>/_vti_bin/owssvr.dll?Cmd=Display&List=<GUID>&XMLDATA=TRUE

According to my SharePoint server name , list name I replaced the placeholders and put the values as i mentioned in my above customer list GUID.

http://home/_vti_bin/owssvr.dll?Cmd=Display&List={5C8C1317-1C3F-4464-8A4F-1F363C84E2F0}&XMLDATA=TRUE

When I copied URL and paste in to browser. The Following dialog box opened 


See the following List XML.


With a specific view

http://<Server_Name>/<sites>/_vti_bin/owssvr.dll?Cmd=Display&List=<GUID>&View=<GUID>&XMLDATA=TRUE

According to my SharePoint server name , list name I replaced the placeholders and put the values as i mentioned in my above customer list GUID. 

http://home/_vti_bin/owssvr.dll?Cmd=Display&List={5C8C1317-1C3F-4464-8A4F-1F363C84E2F0}&View={C738501D-EC82-454F-A9DC-42CA937722FE}&XMLDATA=TRUE

You can also use the following parameters in query string filtered and sort the view data.

FilterFieldn to specify the name of a field in the database, where n is an integer that is limited only by the number of fields allowed in the database table or by the length allowed for the URL field.

FilterValuen to specify the string value on which to filter a field, where n is an integer that is limited only by the length allowed for the URL field.

SortField to specify the name of the field on which to sort.

SortDir to indicate an ascending (asc) or descending (desc) sort order.

Use the above parameters to filter the records.

http://home/_vti_bin/owssvr.dll? CS=109&List={5C8C1317-1C3F-4464-8A4F-1F363C84E2F0}&CacheControl=1&FilterField1=Title&FilterValue1=Customer4&XMLDATA=TRUE

above URL will only return the customer 4 Records.

See the xml output



Part 2 Coming soon...

Comments

  1. Great information - thanks!

    Do you know if there is a way to get the FilterField / FilterValue parameters to work with the Export to Excel? I'm trying to find a way to filter the list without the query downloading the whole list.

    ReplyDelete

Post a Comment

Popular posts from this blog

Types of Features in SharePoint 2013

STS CryptographicException Error : Key set does not exist